From 726af961a92571acf2ebf206a1f74b8c33db6583 Mon Sep 17 00:00:00 2001 From: handreas <andreas.hamacher@monash.edu> Date: Fri, 28 Feb 2020 09:11:15 +0000 Subject: [PATCH] updating server rebuild --- CICD/heat/server_rebuild.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CICD/heat/server_rebuild.sh b/CICD/heat/server_rebuild.sh index 2e9aa620..00420602 100755 --- a/CICD/heat/server_rebuild.sh +++ b/CICD/heat/server_rebuild.sh @@ -38,12 +38,15 @@ host_group_mapping=$(openstack server list --long -f json | python3 -c "import j # all available ansible_host_groups available_groups=$(echo $host_group_mapping | python3 -c "import json,sys;mapping=json.load(sys.stdin);output=[];[output.extend(v) for v in mapping.values()];print(output)" | tr -d "[',]") +echo "available groups are $available_groups" # if the first input parameter is all then rebuild all groups if [[ "$1" == "all" ]]; then NODETYPES=$available_groups fi echo "going to update group $NODETYPES" -server_list=$(echo $host_group_mapping | python3 -c "import json,sys;mapping=json.load(sys.stdin);avail_groups='$available_groups'.split();print([k for k in mapping.keys() if len(set(mapping[k]).intersection(set(avail_groups))) > 0])" | tr -d "[,]'" | xargs -n1 | sort -u) +server_list=$(echo $host_group_mapping | python3 -c "import json,sys;mapping=json.load(sys.stdin);node_types='$NODETYPES'.split();output=[k for k in mapping.keys() if len(set(mapping[k]).intersection(set(node_types))) > 0];print(output)" | tr -d "[,]'" | xargs -n1 | sort -u) + +echo "server list is $server_list" rebuild_func(){ echo "rebuilding server $1" openstack server rebuild --wait $1 -- GitLab