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 ##############################################################################
13 import utils.infra_setup.passwordless_SSH.ssh as ssh
15 LOG = logging.getLogger(__name__)
16 DEL_DOCKER_SCRIPT = "/home/opnfv/bottlenecks/docker/docker_cleanup.sh"
19 def ssh_del_docker(docker_name):
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)
30 status, stdout, stderr = ssh_d.execute(
33 with open(DEL_DOCKER_SCRIPT) as stdin_file:
34 ssh_d.run("cat > /etc/docker_cleanup.sh",
37 ssh_d.run("cd /etc/ && bash ./docker_cleanup.sh -d " +
41 def local_del_docker(docker_name):
42 os.system('bash ' + DEL_DOCKER_SCRIPT + ' -d ' + docker_name)
45 ssh_del_docker('cadvisor')
46 ssh_del_docker('barometer')
48 local_del_docker('prometheus')
49 local_del_docker('cadvisor')
50 local_del_docker('barometer')
51 local_del_docker('grafana')
52 local_del_docker('collectd')