fix post-install.sh 83/24883/4
authorRyota MIBU <r-mibu@cq.jp.nec.com>
Fri, 25 Nov 2016 04:34:45 +0000 (23:34 -0500)
committerTim Rozet <trozet@redhat.com>
Tue, 24 Jan 2017 17:31:33 +0000 (17:31 +0000)
If sahara and swift are not configured, the post install script will
fail during removals of endpoints for sahara and swift.

This patch adds checks whether endpoints to be removed exist or not.

Change-Id: I8e417dbe6e51461d7c4ef1e2368865917b2f8279
Signed-off-by: Ryota MIBU <r-mibu@cq.jp.nec.com>
lib/post-install-functions.sh

index c951478..51287c4 100755 (executable)
@@ -107,14 +107,14 @@ fi
 echo "Removing sahara endpoint and service"
 sahara_service_id=\$(openstack service list | grep sahara | cut -d ' ' -f 2)
 sahara_endpoint_id=\$(openstack endpoint list | grep sahara | cut -d ' ' -f 2)
-openstack endpoint delete \$sahara_endpoint_id
-openstack service delete \$sahara_service_id
+[[ -n "\$sahara_endpoint_id" ]] && openstack endpoint delete \$sahara_endpoint_id
+[[ -n "\$sahara_service_id" ]] && openstack service delete \$sahara_service_id
 
 echo "Removing swift endpoint and service"
 swift_service_id=\$(openstack service list | grep swift | cut -d ' ' -f 2)
 swift_endpoint_id=\$(openstack endpoint list | grep swift | cut -d ' ' -f 2)
-openstack endpoint delete \$swift_endpoint_id
-openstack service delete \$swift_service_id
+[[ -n "\$swift_endpoint_id" ]] && openstack endpoint delete \$swift_endpoint_id
+[[ -n "\$swift_service_id" ]] && openstack service delete \$swift_service_id
 
 if [ "${deploy_options_array['dataplane']}" == 'fdio' ] || [ "${deploy_options_array['dataplane']}" == 'ovs_dpdk' ]; then
     for flavor in \$(openstack flavor list -c Name -f value); do