1 ##############################################################################
2 # Copyright (c) 2017 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 cadvisor_client_install_sh =\
16 "/home/opnfv/bottlenecks/monitor/dispatch/install_cadvisor_client.sh"
18 with open('/tmp/pod.yaml') as f:
19 dataMap = yaml.safe_load(f)
22 if (y['role'] == 'Controller') or (y['role'] == 'Compute'):
25 pwd = str(y['password'])
26 ssh_d = ssh.SSH(user, host=ip, password=pwd)
27 status, stdout, stderr = ssh_d.execute(
28 "cd /etc && mkdir cadvisor_config"
32 "Command: \"mkdir cadvisor_config\" failed.")
33 logger.info(stdout.splitlines())
34 with open(cadvisor_client_install_sh) as stdin_file:
35 ssh_d.run("cat > /etc/cadvisor_config/install.sh",
37 status, stdout, stderr = ssh_d.execute(
38 "sudo apt-get install -y docker.io"
41 raise Exception("Command for installing docker failed.")
42 logger.info(stdout.splitlines())
43 ssh_d.run("cd /etc/cadvisor_config/ && bash ./install.sh")