Skip to content

Commit 175dbe4

Browse files
committed
Made them handle a failure message from AWS better.
1 parent fb475b9 commit 175dbe4

File tree

6 files changed

+36
-6
lines changed

6 files changed

+36
-6
lines changed

Management-Utilities/fsx-ontap-aws-cli-scripts/create_fsxn_filesystem

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,12 @@ else
180180
fi
181181
if [ "$status" != "CREATING" -a "$status" != "PENDING" ]; then
182182
printf "\nError, failed to create the file system. Status = $status\n" 1>&2
183-
cat $tmpout 1>&2
183+
reason="$(jq -r '.FileSystems[0].LifecycleTransitionReason.Message' $tmpout 2> /dev/null)"
184+
if [ ! -z "$reason" ]; then
185+
echo "Reason: $reason" 1>&2
186+
else
187+
cat $tmpout 1>&2
188+
fi
184189
exit 1
185190
fi
186191
printf "."

Management-Utilities/fsx-ontap-aws-cli-scripts/create_fsxn_svm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ else
116116
fi
117117
if [ "$status" != "CREATING" -a "$status" != "PENDING" ]; then
118118
printf "\nError, failed to create SVM with SVM ID '$svmId'. Status = $status\n" 1>&2
119-
cat $tmpout 1>&2
119+
reason="$(jq -r '.StorageVirtualMachines[0].LifecycleTransitionReason.Message' $tmpout)"
120+
if [ ! -z "$reason" ]; then
121+
echo "Reason: $reason" 1>&2
122+
else
123+
cat $tmpout 1>&2
124+
fi
120125
exit 1
121126
fi
122127
else

Management-Utilities/fsx-ontap-aws-cli-scripts/create_fsxn_volume

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,12 @@ else
105105
fi
106106
if [ $status != "CREATING" -a $status != "PENDING" ]; then
107107
echo "Error, volume $volumeId creation failed." 1>&2
108-
cat $tmpout 1>&2
108+
reason="$(jq -r '.Volumes[0].LifecycleTransitionReason.Message' $tmpout 2> /dev/null)"
109+
if [ -n "$reason" ]; then
110+
echo "Reason: $reason" 1>&2
111+
else
112+
cat $tmpout 1>&2
113+
fi
109114
exit 1
110115
fi
111116
echo -n "."

Management-Utilities/fsx-ontap-aws-cli-scripts/delete_fsxn_filesystem

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,12 @@ else
213213
status=$(jq -r '.FileSystems[0].Lifecycle' $tmpout 2> /dev/null)
214214
if [ "$status" != "DELETING" -a "$status" != "PENDING" ]; then
215215
printf "\nError, failed to delete file system with file system ID '$fsid'. Status = $status\n" 1>&2
216-
cat $tmpout 1>&2
216+
reason="$(jq -r '.FileSystems[0].LifecycleTransitionReason.Message' $tmpout 2> /dev/null)"
217+
if [ ! -z "$reason" ]; then
218+
printf "Reason: $reason\n" 1>&2
219+
else
220+
cat $tmpout 1>&2
221+
fi
217222
exit 1
218223
else
219224
printf "."

Management-Utilities/fsx-ontap-aws-cli-scripts/delete_fsxn_svm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,12 @@ else
209209
status=$(jq -r '.StorageVirtualMachines[0].Lifecycle' $tmpout 2> /dev/null)
210210
if [ "$status" != "DELETING" -a "$status" != "PENDING" ]; then
211211
printf "\nError, failed to delete SVM with SVM ID '$svmID'. Status = $status\n" 1>&2
212-
cat $tmpout 1>&2
212+
reason="$(jq -r '.StorageVirtualMachines[0].LifecycleTransitionReason.Message' $tmpout 2> /dev/null)"
213+
if [ ! -z "$reason" ]; then
214+
echo "Reason: $reason" 1>&2
215+
else
216+
cat $tmpout 1>&2
217+
fi
213218
exit 1
214219
else
215220
printf "."

Management-Utilities/fsx-ontap-aws-cli-scripts/delete_fsxn_volume

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ waitForVolumeDelete () {
4747
status=$(jq -r .Volumes[0].Lifecycle $tmpout 2> /dev/null)
4848
if [ "$status" != "DELETING" -a "$status" != "PENDING" ]; then
4949
printf "\nError, failed to delete volume with volume ID '$volumeId'. Status = ${status}.\n" 1>&2
50-
cat $tmpout 1>&2
50+
reason="$(jq -r '.Volumes[0].LifecycleTransitionReason.Message' $tmpout 2> /dev/null)"
51+
if [ ! -z "$reason" ]; then
52+
echo "Reason: $reason" 1>&2
53+
else
54+
cat $tmpout 1>&2
55+
fi
5156
return 1
5257
fi
5358
else

0 commit comments

Comments
 (0)