Sort ResourceGroup resource list
authorJames Slagle <jslagle@redhat.com>
Thu, 16 Feb 2017 21:19:23 +0000 (16:19 -0500)
committerJames Slagle <jslagle@redhat.com>
Mon, 27 Mar 2017 20:14:10 +0000 (20:14 +0000)
We should sort the results by resource_name when listing resources in
the ResourceGroup stack in get-occ-config.sh, as the order is not
guaranteed. We want the order to always be numerical ascending by
resource_name (which are just integers starting at 0).

Change-Id: Iccef81e4dfd9586e0030f20bdde131d1a885eb19
Closes-Bug: #1665458
(cherry picked from commit c5e5d21a61808f7c09b85a2750a905bb57b54be1)

deployed-server/scripts/get-occ-config.sh

index 6c196f9..d0cc4df 100755 (executable)
@@ -63,7 +63,7 @@ for role in $OVERCLOUD_ROLES; do
         rg_stack=$(openstack stack resource show overcloud $role -c physical_resource_id -f value)
     done
 
-    stacks=$(openstack stack resource list $rg_stack -c physical_resource_id -f value)
+    stacks=$(openstack stack resource list $rg_stack -c resource_name -c physical_resource_id -f json | jq -r "sort_by(.resource_name) | .[] | .physical_resource_id")
 
     i=0