get-occ-config.sh replace deprecated heat commands

The modern openstack equivalent heat commands require no awk and will
be slightly more efficient.

The roles variable is optionally populated by OVERCLOUD_ROLES so that
a subset of roles can be specified.

Change-Id: I6b66cb3bd81825fba726dd45b0db25896908f6dd
This commit is contained in:
Steve Baker 2016-11-27 22:17:07 +00:00
parent 597de6ec40
commit 4f88933f9f

View File

@ -18,21 +18,21 @@ read -a BlockStorage_hosts_a <<< $BLOCKSTORAGE_HOSTS
read -a ObjectStorage_hosts_a <<< $OBJECTSTORAGE_HOSTS read -a ObjectStorage_hosts_a <<< $OBJECTSTORAGE_HOSTS
read -a CephStorage_hosts_a <<< $CEPHSTORAGE_HOSTS read -a CephStorage_hosts_a <<< $CEPHSTORAGE_HOSTS
roles="Controller Compute BlockStorage ObjectStorage CephStorage" roles=${OVERCLOUD_ROLES:-"Controller Compute BlockStorage ObjectStorage CephStorage"}
admin_user_id=$(openstack user show admin -c id -f value) admin_user_id=$(openstack user show admin -c id -f value)
admin_project_id=$(openstack project show admin -c id -f value) admin_project_id=$(openstack project show admin -c id -f value)
function check_stack { function check_stack {
local stack_to_check=$1 local stack_to_check=${1:-""}
if [ "$stack_to_check" = "|" ]; then if [ "$stack_to_check" = "" ]; then
echo Stack not created echo Stack not created
return 1 return 1
fi fi
echo Checking if $1 stack is created echo Checking if $1 stack is created
set +e set +e
heat resource-list $stack_to_check openstack stack resource list $stack_to_check
rc=$? rc=$?
set -e set -e
@ -49,13 +49,13 @@ for role in $roles; do
sleep $SLEEP_TIME sleep $SLEEP_TIME
done done
rg_stack=$(heat resource-list overcloud | grep " $role " | awk '{print $4}') rg_stack=$(openstack stack resource show overcloud $role -c physical_resource_id -f value)
while ! check_stack $rg_stack; do while ! check_stack $rg_stack; do
sleep $SLEEP_TIME sleep $SLEEP_TIME
rg_stack=$(heat resource-list overcloud | grep " $role " | awk '{print $4}') rg_stack=$(openstack stack resource show overcloud $role -c physical_resource_id -f value)
done done
stacks=$(heat resource-list $rg_stack | grep OS::TripleO::$role | awk '{print $4}') stacks=$(openstack stack resource list $rg_stack -c physical_resource_id -f value)
i=0 i=0
@ -65,13 +65,13 @@ for role in $roles; do
server_resource_name="NovaCompute" server_resource_name="NovaCompute"
fi fi
server_stack=$(heat resource-list $stack | grep " $server_resource_name " | awk '{print $4}') server_stack=$(openstack stack resource show $stack $server_resource_name -c physical_resource_id -f value)
while ! check_stack $server_stack; do while ! check_stack $server_stack; do
sleep $SLEEP_TIME sleep $SLEEP_TIME
server_stack=$(heat resource-list $stack | grep " $server_resource_name " | awk '{print $4}') server_stack=$(openstack stack resource show $stack $server_resource_name -c physical_resource_id -f value)
done done
deployed_server_stack=$(heat resource-list $server_stack | grep "deployed-server" | awk '{print $4}') deployed_server_stack=$(openstack stack resource show $server_stack deployed-server -c physical_resource_id -f value)
echo "======================" echo "======================"
echo "$role$i os-collect-config.conf configuration:" echo "$role$i os-collect-config.conf configuration:"