diff options
author | Zhou Ya <zhou.ya@zte.com.cn> | 2016-12-22 17:23:41 +0800 |
---|---|---|
committer | zhou ya <zhou.ya@zte.com.cn> | 2017-01-03 02:24:50 +0000 |
commit | d8cb12e71483a666f59807ae6d78a7df63ca222e (patch) | |
tree | f432369eeb11501c77531cb4a24debcbb41a054a | |
parent | e77f23d3483621c52c1c2e25e9a0017ff1126ccd (diff) |
modify the fixed para to a more flexible way
we could have many types of os version,such as centos7 and
centos6,we should not fix this into a hard way name,for we
can change the os_version
Change-Id: I3d0f12fbcd7d25369c782a8f4dd5008b702cecdd
Signed-off-by: Zhou Ya <zhou.ya@zte.com.cn>
-rwxr-xr-x | deploy/tempest.py | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/deploy/tempest.py b/deploy/tempest.py index 1efe159f..3459cb07 100755 --- a/deploy/tempest.py +++ b/deploy/tempest.py @@ -14,11 +14,11 @@ from daisyclient.v1 import client as daisy_client import get_conf import traceback import time +import os daisy_version = 1.0 -daisy_endpoint = "http://127.0.0.1:19292" -client = daisy_client.Client(version=daisy_version, endpoint=daisy_endpoint) -iso_path = "/var/lib/daisy/kolla/CentOS-7-x86_64-DVD-1511.iso" +daisyrc_path = "/root/daisyrc_admin" +iso_path = "/var/lib/daisy/kolla/" deployment_interface = "ens3" cluster_name = "clustertest" @@ -46,6 +46,17 @@ def print_bar(msg): print ("--------------------------------------------") +def get_endpoint(file_path): + for line in open(file_path): + if 'OS_ENDPOINT' in line: + daisyrc_admin_line = line.strip() + daisy_endpoint = daisyrc_admin_line.split("=")[1] + return daisy_endpoint + +daisy_endpoint = get_endpoint(daisyrc_path) +client = daisy_client.Client(version=daisy_version, endpoint=daisy_endpoint) + + def prepare_install(): try: print("get config...") @@ -141,7 +152,12 @@ def add_hosts_interface(cluster_id, hosts_info, host_interface_map, interface_name = interface['name'] interface['assigned_networks'] = \ host_interface_map[interface_name] - host['os_version'] = iso_path + pathlist = os.listdir(iso_path) + for filename in pathlist: + if filename.endswith('iso'): + host['os_version'] = iso_path + filename + if host['os_version'] == iso_path: + print("do not have os iso file in /var/lib/daisy/kolla/.") client.hosts.update(host['id'], **host) print("update role...") add_host_role(cluster_id, host['id'], host['name'], vip) |