Skip to content

Commit bb1e906

Browse files
committed
Made it skip non-FSxN file systems.
1 parent 9d34d12 commit bb1e906

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fsx-ontap-aws-cli-scripts/list_fsxn_filesystems

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ fi
160160
# Define the query string that is used to get only the fields needed to generate the output.
161161
# It also makes the 'jq' commands below easily, since it flattens the JSON structure.
162162
queryString="FileSystems[*].{
163+
FileSystemType: FileSystemType,
163164
FileSystemId: FileSystemId,
164165
Lifecycle:Lifecycle,
165166
Name:Tags[?Key=='Name']|[0].Value,
@@ -214,7 +215,7 @@ for region in ${regions[*]}; do
214215
fi
215216

216217
printf "$region\n"
217-
jq -r '.[] | .FileSystemId + " " + .Lifecycle + " =" + .Name + "="' $fileSystemsFile | while read fs fsStatus fsName; do
218+
jq -r '.[] | if(.FileSystemType != "ONTAP") then empty else .FileSystemId + " " + .Lifecycle + " =" + .Name + "=" end' $fileSystemsFile | while read fs fsStatus fsName; do
218219
x="${fsName#=}"
219220
fsName="${x%=}"
220221
[ "$showStatus" == "true" ] && printf "\t$fs($fsStatus) - '$fsName'\n"
@@ -244,10 +245,9 @@ for region in ${regions[*]}; do
244245
# 11 = throughput
245246
# 12 = size
246247
if [ ! -z "$1" ]; then
247-
#set -x
248-
jq -r '.[] | .FileSystemId + "," + .ResourceARN + "," + (if((.Name | tostring) | test("'$1'")) then .Name else empty end) + "," + .Lifecycle + "," + .ManagementIp + "," + .VpcId + "," + .SubnetId + "," + (if(.AutomaticBackupRetentionDays == null) then "Dissabled" else (.AutomaticBackupRetentionDays | tostring) end) + "," + .DeploymentType + "," + (.DiskIopsConfiguration | tostring) + "," + (.ThroughputCapacity | tostring) + "," + (.StorageCapacity | tostring)' $fileSystemsFile > $tmpout
248+
jq -r '.[] | if(.FileSystemType == "ONTAP") then .FileSystemId + "," + .ResourceARN + "," + (if((.Name | tostring) | test("'$1'")) then .Name else empty end) + "," + .Lifecycle + "," + .ManagementIp + "," + .VpcId + "," + .SubnetId + "," + (if(.AutomaticBackupRetentionDays == null) then "Dissabled" else (.AutomaticBackupRetentionDays | tostring) end) + "," + .DeploymentType + "," + (.DiskIopsConfiguration | tostring) + "," + (.ThroughputCapacity | tostring) + "," + (.StorageCapacity | tostring) else empty end' $fileSystemsFile > $tmpout
249249
else
250-
jq -r '.[] | .FileSystemId + "," + .ResourceARN + "," + .Name + "," + .Lifecycle + "," + .ManagementIp + "," + .VpcId + "," + .SubnetId + "," + if(.AutomaticBackupRetentionDays == null) then "Dissabled" else (.AutomaticBackupRetentionDays | tostring) end + "," + .DeploymentType + "," + (.DiskIopsConfiguration | tostring) + "," + (.ThroughputCapacity | tostring) + "," + (.StorageCapacity | tostring)' $fileSystemsFile > $tmpout
250+
jq -r '.[] | if(.FileSystemType == "ONTAP") then .FileSystemId + "," + .ResourceARN + "," + .Name + "," + .Lifecycle + "," + .ManagementIp + "," + .VpcId + "," + .SubnetId + "," + if(.AutomaticBackupRetentionDays == null) then "Dissabled" else (.AutomaticBackupRetentionDays | tostring) end + "," + .DeploymentType + "," + (.DiskIopsConfiguration | tostring) + "," + (.ThroughputCapacity | tostring) + "," + (.StorageCapacity | tostring) else empty end' $fileSystemsFile > $tmpout
251251
fi
252252

253253
if [ "$includeExtraInfo" == "true" ]; then

0 commit comments

Comments
 (0)