Skip to content

Commit

Permalink
Fix Azure CloudSubnet missing address_prefix
Browse files Browse the repository at this point in the history
Azure moved from a single static Subnet.addressPrefix to an array of
addressPrefixes in the newer API version.  The older API version would
return no addressPrefix causing a NoMethodError.
  • Loading branch information
agrare committed Aug 27, 2024
1 parent 6cc3d9c commit 750c29f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ def cloud_networks

def cloud_subnets(persister_cloud_networks, cloud_network)
cloud_network.properties.subnets.each do |subnet|
uid = subnet.id
uid = subnet.id
cidr = subnet.properties.address_prefixes.first

persister.cloud_subnets.build(
:ems_ref => uid,
:name => subnet.name,
:cidr => subnet.properties.address_prefix,
:cidr => cidr,
:cloud_network => persister_cloud_networks,
:availability_zone => persister.availability_zones.lazy_find('default'),
:network_router => persister.network_routers.lazy_find(subnet.properties.try(:route_table).try(:id))
Expand Down
2 changes: 1 addition & 1 deletion config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
:storage_disk: "2017-03-30"
:template_deployment: "2017-08-01"
:virtual_machine: "2017-12-01"
:virtual_network: "2017-11-01"
:virtual_network: "2023-11-01"
:blacklisted_event_names:
- storageAccounts_listKeys_BeginRequest
- storageAccounts_listKeys_EndRequest
Expand Down

0 comments on commit 750c29f

Please sign in to comment.