From 95d03fed865a06760803724103fb35e61f75d913 Mon Sep 17 00:00:00 2001 From: Sergey Kraynev Date: Wed, 3 Aug 2016 12:38:06 +0300 Subject: [PATCH] Fix errors reported by shellcheck for Zuul and Nodepool Change-Id: I2c5fbf234a1bb1c6c27a562f6b4aa6a7e2651ae2 --- .../package/Resources/scripts/get_api_token.sh | 6 +++--- .../package/Resources/scripts/release_resources.sh | 12 ++++++------ .../Zuul/package/Resources/scripts/gen_rsa_key.sh | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/murano-apps/Nodepool/package/Resources/scripts/get_api_token.sh b/murano-apps/Nodepool/package/Resources/scripts/get_api_token.sh index 39dd19f..31d422e 100644 --- a/murano-apps/Nodepool/package/Resources/scripts/get_api_token.sh +++ b/murano-apps/Nodepool/package/Resources/scripts/get_api_token.sh @@ -7,12 +7,12 @@ cmd="curl --user '$username:$password' http://${jenkins_host}:8080/me/configure # Jenkins might not be ready at this point. # Retry logic is used here. -token=$(eval $cmd) +token=$(eval "$cmd") tries=10 while [ -z "$token" ]; do sleep 20 - token=$(eval $cmd) + token=$(eval "$cmd") tries=$((tries-1)) @@ -21,4 +21,4 @@ while [ -z "$token" ]; do fi done -echo $token +echo "$token" diff --git a/murano-apps/Nodepool/package/Resources/scripts/release_resources.sh b/murano-apps/Nodepool/package/Resources/scripts/release_resources.sh index 7dcf72a..bf977b1 100755 --- a/murano-apps/Nodepool/package/Resources/scripts/release_resources.sh +++ b/murano-apps/Nodepool/package/Resources/scripts/release_resources.sh @@ -9,20 +9,20 @@ server_ids=$(mysql -u nodepool --password=nodepool nodepool -e 'select external_ image_ids=$(mysql -u nodepool --password=nodepool nodepool -e 'select external_id from snapshot_image' | grep -o '[-0-9a-f]\{36\}') # Get token and service catalog. -resp=$(curl -H "Content-Type: application/json" -X POST $OS_AUTH_URL/tokens --data '{"auth": {"tenantName": "'$OS_TENANT_NAME'", "passwordCredentials": {"username": "'$OS_USERNAME'", "password": "'$OS_PASSWORD'"}}}') +resp=$(curl -H "Content-Type: application/json" -X POST "$OS_AUTH_URL/tokens" --data '{"auth": {"tenantName": '"$OS_TENANT_NAME"', "passwordCredentials": {"username": '"$OS_USERNAME"', "password": '"$OS_PASSWORD"'}}}') -token=$(echo $resp | json_pp | grep -A15 '"token"' | sed -e '/"tenant"/,+7d' | grep '"id"' | cut -d '"' -f 4) -nova_url=$(echo $resp | json_pp | grep '8774/v2' | grep publicURL | cut -d '"' -f 4) -glance_url=$(echo $resp | json_pp | grep ':9292' | grep publicURL | cut -d '"' -f 4) +token=$(echo "$resp" | json_pp | grep -A15 '"token"' | sed -e '/"tenant"/,+7d' | grep '"id"' | cut -d '"' -f 4) +nova_url=$(echo "$resp" | json_pp | grep '8774/v2' | grep publicURL | cut -d '"' -f 4) +glance_url=$(echo "$resp" | json_pp | grep ':9292' | grep publicURL | cut -d '"' -f 4) # Clean up servers. for id in $server_ids do - curl -X DELETE -H "X-Auth-Token: $token" $nova_url/servers/$id + curl -X DELETE -H "X-Auth-Token: $token" "$nova_url/servers/$id" done # Clean up images. for id in $image_ids do - curl -X DELETE -H "X-Auth-Token: $token" $glance_url/v1/images/$id + curl -X DELETE -H "X-Auth-Token: $token" "$glance_url/v1/images/$id" done diff --git a/murano-apps/Zuul/package/Resources/scripts/gen_rsa_key.sh b/murano-apps/Zuul/package/Resources/scripts/gen_rsa_key.sh index c2c9a75..6f21e3c 100644 --- a/murano-apps/Zuul/package/Resources/scripts/gen_rsa_key.sh +++ b/murano-apps/Zuul/package/Resources/scripts/gen_rsa_key.sh @@ -4,8 +4,8 @@ datafile='/etc/puppet/hieradata/murano.yaml' ssh-keygen -t rsa -P '' -f zuul_ssh_key -q -content=`cat zuul_ssh_key` +content=$(cat zuul_ssh_key) puppet apply --execute "yaml_setting { 'example': target=>'$datafile', key=>'zuul_ssh_private_key_contents', value=>'$content', }" -content=`cat zuul_ssh_key.pub` -puppet apply --execute "yaml_setting { 'example': target=>'$datafile', key=>'zuul_ssh_pubkey_contents', value=>'$content', }" \ No newline at end of file +content=$(cat zuul_ssh_key.pub) +puppet apply --execute "yaml_setting { 'example': target=>'$datafile', key=>'zuul_ssh_pubkey_contents', value=>'$content', }"