Skip to content
Snippets Groups Projects
Commit b1e476f7 authored by Andreas Hamacher's avatar Andreas Hamacher
Browse files

updating server rebuild

Former-commit-id: 726af961
parent 1d75e924
No related branches found
No related tags found
No related merge requests found
...@@ -38,12 +38,15 @@ host_group_mapping=$(openstack server list --long -f json | python3 -c "import j ...@@ -38,12 +38,15 @@ host_group_mapping=$(openstack server list --long -f json | python3 -c "import j
# all available ansible_host_groups # 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 "[',]") 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 the first input parameter is all then rebuild all groups
if [[ "$1" == "all" ]]; then if [[ "$1" == "all" ]]; then
NODETYPES=$available_groups NODETYPES=$available_groups
fi fi
echo "going to update group $NODETYPES" 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(){ rebuild_func(){
echo "rebuilding server $1" echo "rebuilding server $1"
openstack server rebuild --wait $1 openstack server rebuild --wait $1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment