1 ##############################################################################
2 # Copyright (c) 2018 Huawei Tech and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
12 import utils.infra_setup.passwordless_SSH.ssh as ssh
14 logger = logging.getLogger(__name__)
15 barometer_client_install_sh =\
16 "/home/opnfv/bottlenecks/monitor/dispatch/install_barometer_client.sh"
17 barometer_client_install_conf =\
18 "/home/opnfv/bottlenecks/monitor/config/barometer_client.conf"
20 with open('/tmp/pod.yaml') as f:
21 dataMap = yaml.safe_load(f)
24 if (y['role'] == 'Controller') or (y['role'] == 'Compute'):
27 pwd = str(y['password'])
28 ssh_d = ssh.SSH(user, host=ip, password=pwd)
29 status, stdout, stderr = ssh_d.execute(
30 "cd /etc && mkdir barometer_config"
34 "Command: \"mkdir barometer_config\" failed.")
35 logger.info(stdout.splitlines())
36 with open(barometer_client_install_conf) as stdin_file:
37 ssh_d.run("cat > /etc/barometer_config/\
38 barometer_client.conf",
40 with open(barometer_client_install_sh) as stdin_file:
41 ssh_d.run("cat > /etc/barometer_config/install.sh",
44 status, stdout, stderr = ssh_d.execute(
45 "sudo apt-get install -y docker.io"
48 raise Exception("Command for installing docker failed.")
49 logger.info(stdout.splitlines())
51 ssh_d.run("cd /etc/barometer_config/ && bash ./install.sh")