Skip to content

Commit 87d2c3a

Browse files
committed
ensures instance_id is "unknown" if the metadata query fails or returns nothing.
1 parent 506a4eb commit 87d2c3a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Management-Utilities/ec2-user-data-iscsi-create-and-mount/linux_userData.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ else
161161
fi
162162

163163
instance_id=$(ec2-metadata -i | awk '{print $2}')
164+
if [ -z "$instance_id" ]; then
165+
instance_id="unknown"
166+
fi
164167

165168
logMessage "Create volume for vserver: ${SVM_NAME} volume name: ${VOLUME_NAME} and size: ${VOLUME_SIZE}g"
166169
createVolumeResult=$(curl -m $TIMEOUT -X POST -u "$ONTAP_USER":"$FSXN_PASSWORD" -k "https://$FSXN_ADMIN_IP/api/storage/volumes" -d '{

0 commit comments

Comments
 (0)