From acb52e5db6884e6d2eeef8351306736a70345556 Mon Sep 17 00:00:00 2001 From: DennyZhang Date: Fri, 11 Oct 2013 00:08:29 -0500 Subject: [PATCH] detect failure of 'keystone token-get' When 'keystone token-get' fails, the caller can't detect the failure. This cause troulbe shooting a bit complicated. Change-Id: I3c58c5fd0e92a87e87546ea797904e08646a1097 Closes-Bug: #1238412 --- exercises/neutron-adv-test.sh | 1 + stack.sh | 1 + tools/upload_image.sh | 1 + 3 files changed, 3 insertions(+) diff --git a/exercises/neutron-adv-test.sh b/exercises/neutron-adv-test.sh index abb29cf333..e0c37ef723 100755 --- a/exercises/neutron-adv-test.sh +++ b/exercises/neutron-adv-test.sh @@ -102,6 +102,7 @@ KEYSTONE="keystone" # and save it. TOKEN=`keystone token-get | grep ' id ' | awk '{print $4}'` +die_if_not_set $LINENO TOKEN "Keystone fail to get token" # Various functions # ----------------- diff --git a/stack.sh b/stack.sh index 7cd7e30d70..024c52ef98 100755 --- a/stack.sh +++ b/stack.sh @@ -1203,6 +1203,7 @@ fi if is_service_enabled g-reg; then TOKEN=$(keystone token-get | grep ' id ' | get_field 2) + die_if_not_set $LINENO TOKEN "Keystone fail to get token" if is_baremetal; then echo_summary "Creating and uploading baremetal images" diff --git a/tools/upload_image.sh b/tools/upload_image.sh index dd21c9f2a8..d81a5c8dab 100755 --- a/tools/upload_image.sh +++ b/tools/upload_image.sh @@ -33,6 +33,7 @@ fi # Get a token to authenticate to glance TOKEN=$(keystone token-get | grep ' id ' | get_field 2) +die_if_not_set $LINENO TOKEN "Keystone fail to get token" # Glance connection info. Note the port must be specified. GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$GLANCE_HOST:9292}