summaryrefslogtreecommitdiffstats
path: root/monitor/automate_cadvisor_client.py
diff options
context:
space:
mode:
authorYang Yu <Gabriel.yuyang@huawei.com>2018-05-02 12:14:49 +0800
committerYang Yu <Gabriel.yuyang@huawei.com>2018-05-02 15:07:48 +0800
commit742fc9ab94ede1187c9146e5336e28fe84d510c5 (patch)
treee63f6b7eba22a907197341bc03efd9fdebc19a40 /monitor/automate_cadvisor_client.py
parent2833e627cbf31eb89f313ec167f215c48fa70217 (diff)
Style-check for monitoring scripts
Fix the style-check errors for monitoring scripts. In another patch, the scripts will be restructured according the dicretory structure. Change-Id: I4149b18177fa1bdeb1b12a84ecad3d7d0b78260b Signed-off-by: Yang Yu <Gabriel.yuyang@huawei.com>
Diffstat (limited to 'monitor/automate_cadvisor_client.py')
-rw-r--r--monitor/automate_cadvisor_client.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/monitor/automate_cadvisor_client.py b/monitor/automate_cadvisor_client.py
index 95b98e9d..f84892dd 100644
--- a/monitor/automate_cadvisor_client.py
+++ b/monitor/automate_cadvisor_client.py
@@ -8,30 +8,34 @@
##############################################################################
import logging
-import sys
import yaml
-sys.path.insert(0, '/home/opnfv/bottlenecks/utils/infra_setup/passwordless_SSH/')
-import ssh
+import utils.infra_setup.passwordless_SSH.ssh as ssh
logger = logging.getLogger(__name__)
+cadvisor_install_sh = "/home/opnfv/bottlenecks/monitor/cadvisor_install.sh"
+
with open('/tmp/pod.yaml') as f:
dataMap = yaml.safe_load(f)
for x in dataMap:
for y in dataMap[x]:
- if (y['role']=='Controller') or (y['role']=='Compute'):
+ if (y['role'] == 'Controller') or (y['role'] == 'Compute'):
ip = str(y['ip'])
user = str(y['user'])
pwd = str(y['password'])
- ssh_d = ssh.SSH(user, host= ip, password= pwd)
- status, stdout, stderr = ssh_d.execute("cd /etc && mkdir cadvisor-config")
+ ssh_d = ssh.SSH(user, host=ip, password=pwd)
+ status, stdout, stderr = ssh_d.execute(
+ "cd /etc && mkdir cadvisor_config"
+ )
if status:
raise Exception("Command failed with non-zero status.")
logger.info(stdout.splitlines())
- with open("/home/opnfv/bottlenecks/monitor/cadvisor_install.sh") as stdin_file:
- ssh_d.run("cat > /etc/cadvisor-config/install.sh", stdin=stdin_file)
- status, stdout, stderr = ssh_d.execute("sudo apt-get install docker.io")
+ with open(cadvisor_install_sh) as stdin_file:
+ ssh_d.run("cat > /etc/cadvisor_config/install.sh",
+ stdin=stdin_file)
+ status, stdout, stderr = ssh_d.execute(
+ "sudo apt-get install docker.io"
+ )
if status:
raise Exception("Command for installing docker failed.")
logger.info(stdout.splitlines())
- ssh_d.run("cd /etc/cadvisor-config/ && bash ./install.sh")
-
+ ssh_d.run("cd /etc/cadvisor_config/ && bash ./install.sh")