Skip to content
Snippets Groups Projects

feat: Add new data volume for XDMod queue data

1 file
+ 5
2
Compare changes
  • Side-by-side
  • Inline
  • The original code assumed only one volume is attached to the specified OpenStack instance. This commit modifies the script to correctly handle scenarios where multiple volumes are attached. The updated code uses an array to store all attached volumes, iterates over the array, and performs actions for each volume. This enhances the script's flexibility and ensures accurate detachment messages for all attached volumes.
    
    Changes:
    - Modified the extraction of the instance ID to handle potential changes in the output structure.
    - Implemented an array to store all attached volumes.
    - Added a loop to iterate over the array and print detachment messages for each volume.
+ 5
2
@@ -136,8 +136,11 @@ production-deploy:
tags: [build]
script:
- 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}')
- echo "Detaching prod_volume_id=${prod_volume} from prod_instance_id=${prod_instance_id}"
- export prod_volumes=($(openstack server show $prod_instance_id -c volumes_attached -f value | awk -F"'" '{print $4}')) # Iterate over the array and perform actions for each volume
- for prod_volume in "${prod_volumes[@]}"; do
- echo "Detaching prod_volume_id=${prod_volume} from prod_instance_id=${prod_instance_id}"
- done
- |
eval $(ssh-agent -s)
chmod 400 "${SSH_PRIV_KEY}"
Loading