Skip to content

Commit 8beac45

Browse files
committed
Fixed a bug where it wouldn't exit if it couldn't find the filesystemID based on the name passed via the -f option.
1 parent 60a61af commit 8beac45

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ else
101101
fi
102102

103103
if [ ! -z "$fileSystemName" ]; then
104-
fileSystemID=$(aws fsx describe-file-systems --output=json 2> /dev/null | jq -r '.FileSystems[] | if((.Tags[] | select(.Key == "Name") .Value) == "'"${fileSystemName}"'") then .FileSystemId else empty end' 2> /dev/null)
104+
fileSystemID=$(aws fsx describe-file-systems --output=json --region=$region 2> /dev/null | jq -r '.FileSystems[] | if((.Tags[] | select(.Key == "Name") .Value) == "'"${fileSystemName}"'") then .FileSystemId else empty end' 2> /dev/null)
105+
if [ -z "$fileSystemID" ]; then
106+
echo "Error, failed to find a file system with the name '$fileSystemName'. Maybe in a different region?" 1>&2
107+
exit 1
108+
fi
105109
fi
106110
#
107111
# Loop on all the regions.

0 commit comments

Comments
 (0)