Skip to content
Snippets Groups Projects
Commit 800ec2b8 authored by Krish Moodbidri's avatar Krish Moodbidri
Browse files

Refactor volume ID retrieval for production environment

Changed the method of retrieving volume IDs for the production environment in the script. 
parent 9496fbe7
No related branches found
No related tags found
No related merge requests found
Pipeline #10410 passed with stages
in 2 minutes and 39 seconds
......@@ -41,8 +41,9 @@ prep-deploy:
openstack volume create --snapshot xdmod-staging-vol-snapshot --size 150 $TF_VAR_data_volume
elif [ "$TARGET_ENV" = "production" ]; then
export prod_instance_id=$(openstack floating ip show $prod_floating_ip -c port_details -f value | awk -F', ' '{print $2}' | awk -F"'" '{print $2}')
export prod_volume=$(openstack server show $prod_instance_id -c volumes_attached -f value | awk -F"'" '{print $4}')
export prod_queue_volume=$(openstack server show $prod_instance_id -c volumes_attached -f value | awk -F"'" '{print $4}' | awk 'NR==2')
export volume_ids=$(openstack server show $prod_instance_id -c volumes_attached | grep -o "id='[a-zA-Z0-9\-]*'" | awk -F "'" '{print $2}')
export prod_volume=$(echo "$volume_ids" | awk 'NR==1')
export prod_queue_volume=$(echo "$volume_ids" | awk 'NR==2')
echo "Detaching prod_volume=${prod_volume} from prod_instance_id=${prod_instance_id} and creating a snapshot"
echo "Detaching prod_queue_volume=${prod_queue_volume} from prod_instance_id=${prod_instance_id} and creating a snapshot"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment