Skip to content

Commit 9a66fb1

Browse files
committed
has host bits set not mandatory for azure storage ip addresses
1 parent bb273bf commit 9a66fb1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/azure-cli/azure/cli/command_modules/storage/_validators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2341,7 +2341,7 @@ def validate_ip_address(namespace):
23412341
if not ip_address:
23422342
return
23432343

2344-
ip_address_networks = [ip_network(ip) for ip in ip_address]
2344+
ip_address_networks = [ip_network(ip, False) for ip in ip_address]
23452345
for idx, ip_address_network in enumerate(ip_address_networks):
23462346
for idx2, ip_address_network2 in enumerate(ip_address_networks):
23472347
if idx == idx2:

src/azure-cli/azure/cli/command_modules/storage/operations/account.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -709,8 +709,8 @@ def add_network_rule(cmd, client, resource_group_name, account_name, action='All
709709
for ip in ip_address:
710710
to_modify = True
711711
for x in rules.ip_rules:
712-
existing_ip_network = ip_network(x.ip_address_or_range)
713-
new_ip_network = ip_network(ip)
712+
existing_ip_network = ip_network(x.ip_address_or_range, False)
713+
new_ip_network = ip_network(ip, False)
714714
if new_ip_network.overlaps(existing_ip_network):
715715
logger.warning("IP/CIDR %s overlaps with %s, which exists already. Not adding duplicates.",
716716
ip, x.ip_address_or_range)
@@ -739,8 +739,8 @@ def remove_network_rule(cmd, client, resource_group_name, account_name, ip_addre
739739
rules.virtual_network_rules = [x for x in rules.virtual_network_rules
740740
if not x.virtual_network_resource_id.endswith(subnet)]
741741
if ip_address:
742-
to_remove = [ip_network(x) for x in ip_address]
743-
rules.ip_rules = list(filter(lambda x: all(ip_network(x.ip_address_or_range) != i for i in to_remove),
742+
to_remove = [ip_network(x, False) for x in ip_address]
743+
rules.ip_rules = list(filter(lambda x: all(ip_network(x.ip_address_or_range, False) != i for i in to_remove),
744744
rules.ip_rules))
745745

746746
if resource_id:

0 commit comments

Comments
 (0)