summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri Mazmanov <dimitri.mazmanov@ericsson.com>2016-07-25 18:10:25 +0200
committerJose Lausuch <jose.lausuch@ericsson.com>2016-07-25 18:36:02 +0000
commit13bb06afb4f466b1e56c178fdcd2b3ab77dc7dab (patch)
tree05c09a1f24dc3562ff7b232b52124d886613d591
parentc7cd8087c0df17dcbc5e97d62ef942e5cf344028 (diff)
Make environment id dynamic
Removed hardcoded value of fuel environment. The value is now fetched from an environment variable FUEL_ENV. Signed-off-by: Dimitri Mazmanov <dimitri.mazmanov@ericsson.com> Change-Id: Iae8e5139f013ca7947e79a1a9a44efd82f48b95b
-rwxr-xr-xutils/fetch_os_creds.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/utils/fetch_os_creds.sh b/utils/fetch_os_creds.sh
index 88e964b15..34c81af1a 100755
--- a/utils/fetch_os_creds.sh
+++ b/utils/fetch_os_creds.sh
@@ -80,9 +80,16 @@ if [ "$installer_type" == "fuel" ]; then
#ip_fuel="10.20.0.2"
verify_connectivity $installer_ip
+ env=$(sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
+ 'fuel env'|grep operational|tail -1|awk '{print $1}') &> /dev/null
+ if [ -z $env ]; then
+ error "No operational environment detected in Fuel"
+ fi
+ env_id="${FUEL_ENV:-$env}"
+
# Check if controller is alive (online='True')
controller_ip=$(sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
- 'fuel node -env 1 | grep controller | grep "True\| 1" | awk -F\| "{print \$5}" | tail -1' | \
+ 'fuel node --env ${env_id} | grep controller | grep "True\| 1" | awk -F\| "{print \$5}" | tail -1' | \
sed 's/ //g') &> /dev/null
if [ -z $controller_ip ]; then