diff options
Diffstat (limited to 'monitor/barometer_automated_client_install.py')
-rw-r--r-- | monitor/barometer_automated_client_install.py | 31 |
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") |