Fix errors reported by shellcheck for Zuul and Nodepool
Change-Id: I2c5fbf234a1bb1c6c27a562f6b4aa6a7e2651ae2
This commit is contained in:
parent
a4a52e5b54
commit
95d03fed86
@ -7,12 +7,12 @@ cmd="curl --user '$username:$password' http://${jenkins_host}:8080/me/configure
|
|||||||
|
|
||||||
# Jenkins might not be ready at this point.
|
# Jenkins might not be ready at this point.
|
||||||
# Retry logic is used here.
|
# Retry logic is used here.
|
||||||
token=$(eval $cmd)
|
token=$(eval "$cmd")
|
||||||
tries=10
|
tries=10
|
||||||
|
|
||||||
while [ -z "$token" ]; do
|
while [ -z "$token" ]; do
|
||||||
sleep 20
|
sleep 20
|
||||||
token=$(eval $cmd)
|
token=$(eval "$cmd")
|
||||||
|
|
||||||
tries=$((tries-1))
|
tries=$((tries-1))
|
||||||
|
|
||||||
@ -21,4 +21,4 @@ while [ -z "$token" ]; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo $token
|
echo "$token"
|
||||||
|
@ -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\}')
|
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.
|
# 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)
|
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)
|
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)
|
glance_url=$(echo "$resp" | json_pp | grep ':9292' | grep publicURL | cut -d '"' -f 4)
|
||||||
|
|
||||||
# Clean up servers.
|
# Clean up servers.
|
||||||
for id in $server_ids
|
for id in $server_ids
|
||||||
do
|
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
|
done
|
||||||
|
|
||||||
# Clean up images.
|
# Clean up images.
|
||||||
for id in $image_ids
|
for id in $image_ids
|
||||||
do
|
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
|
done
|
||||||
|
@ -4,8 +4,8 @@ datafile='/etc/puppet/hieradata/murano.yaml'
|
|||||||
|
|
||||||
ssh-keygen -t rsa -P '' -f zuul_ssh_key -q
|
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', }"
|
puppet apply --execute "yaml_setting { 'example': target=>'$datafile', key=>'zuul_ssh_private_key_contents', value=>'$content', }"
|
||||||
|
|
||||||
content=`cat zuul_ssh_key.pub`
|
content=$(cat zuul_ssh_key.pub)
|
||||||
puppet apply --execute "yaml_setting { 'example': target=>'$datafile', key=>'zuul_ssh_pubkey_contents', value=>'$content', }"
|
puppet apply --execute "yaml_setting { 'example': target=>'$datafile', key=>'zuul_ssh_pubkey_contents', value=>'$content', }"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user