Skip to content

Commit 6d1296a

Browse files
authored
fix: (IAC-506) Modified if-else logic to be readable and avoid duplicates (#245)
* fix: (IAC-506) Added if-else logic to avoid duplicate exports
1 parent a2ccec5 commit 6d1296a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

files/cloud-init/nfs/cloud-config

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@ runcmd:
5656
#
5757
# Update /etc/exports - NOTE: The CIDR provided works for the whole VPC
5858
#
59-
- echo "/export ${aks_cidr_block}(rw,no_root_squash,async,insecure,fsid=0,crossmnt,no_subtree_check)" >> /etc/exports
60-
- echo "/export ${misc_cidr_block}(rw,no_root_squash,async,insecure,fsid=0,crossmnt,no_subtree_check)" >> /etc/exports
59+
- if [ "${aks_cidr_block}" != "${misc_cidr_block}" ]
60+
- then
61+
- echo "/export ${aks_cidr_block}(rw,no_root_squash,async,insecure,fsid=0,crossmnt,no_subtree_check)" >> /etc/exports
62+
- echo "/export ${misc_cidr_block}(rw,no_root_squash,async,insecure,fsid=0,crossmnt,no_subtree_check)" >> /etc/exports
63+
- else
64+
- echo "/export ${aks_cidr_block}(rw,no_root_squash,async,insecure,fsid=0,crossmnt,no_subtree_check)" >> /etc/exports
65+
- fi
6166
#
6267
# Restart nfs-server service
6368
#

0 commit comments

Comments
 (0)