summaryrefslogtreecommitdiffstats
path: root/monitor/barometer_automated_client_install.py
diff options
context:
space:
mode:
authorYang Yu <Gabriel.yuyang@huawei.com>2018-05-02 12:14:49 +0800
committerYu Yang (Gabriel) <Gabriel.yuyang@huawei.com>2018-05-03 08:08:54 +0000
commit14add4c9ee3c3114a92ee6c8cf6a6f677ec386a8 (patch)
treee63f6b7eba22a907197341bc03efd9fdebc19a40 /monitor/barometer_automated_client_install.py
parentbb0af04f78e264c2500a574e2c48f249a2fa5bd2 (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> (cherry picked from commit 742fc9ab94ede1187c9146e5336e28fe84d510c5)
Diffstat (limited to 'monitor/barometer_automated_client_install.py')
-rw-r--r--monitor/barometer_automated_client_install.py31
1 files changed, 19 insertions, 12 deletions
diff --git a/monitor/barometer_automated_client_install.py b/monitor/barometer_automated_client_install.py
index 7bbfa701..9bb2c6b1 100644
--- a/monitor/barometer_automated_client_install.py
+++ b/monitor/barometer_automated_client_install.py
@@ -8,29 +8,36 @@
##############################################################################
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__)
+barometer_client_install_sh =\
+ "/home/opnfv/bottlenecks/monitor/barometer_install_client.sh"
+barometer_client_install_conf =\
+ "/home/opnfv/bottlenecks/monitor/barometer_client.conf"
+
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 barometer-config")
+ ssh_d = ssh.SSH(user, host=ip, password=pwd)
+ status, stdout, stderr = ssh_d.execute(
+ "cd /etc && mkdir barometer_config"
+ )
if status:
raise Exception("Command failed with non-zero status.")
logger.info(stdout.splitlines())
- with open("/home/opnfv/bottlenecks/monitor/barometer_client.conf") as stdin_file:
- ssh_d.run("cat > /etc/barometer-config/barometer_client_collectd.conf", stdin=stdin_file)
-
- with open("/home/opnfv/bottlenecks/monitor/barometer_install_client.sh") as stdin_file:
- ssh_d.run("cat > /etc/barometer-config/install.sh", stdin=stdin_file)
+ with open(barometer_client_install_conf) as stdin_file:
+ ssh_d.run("cat > /etc/barometer_config/\
+ barometer_client_collectd.conf",
+ stdin=stdin_file)
+ with open(barometer_client_install_sh) as stdin_file:
+ ssh_d.run("cat > /etc/barometer_config/install.sh",
+ stdin=stdin_file)
- ssh_d.run("cd /etc/barometer-config/ && bash ./install.sh")
+ ssh_d.run("cd /etc/barometer_config/ && bash ./install.sh")