Skip to content

Commit

Permalink
fix(ec2): Correctly identify netplan renderer (#5361)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealFalcon committed Jun 5, 2024
1 parent d4661b1 commit d771d1f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cloudinit/sources/DataSourceEc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ def convert_ec2_metadata_network_config(
netcfg["ethernets"][nic_name] = dev_config
return netcfg
# Apply network config for all nics and any secondary IPv4/v6 addresses
is_netplan = distro.network_renderer == netplan.Renderer
is_netplan = isinstance(distro.network_renderer, netplan.Renderer)
macs = sorted(macs_to_nics.keys())
nic_order = _build_nic_order(macs_metadata, macs)
for mac in macs:
Expand Down
6 changes: 3 additions & 3 deletions tests/unittests/sources/test_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ def test_convert_ec2_metadata_network_config_multi_nics_ipv4(self):
},
}
distro = mock.Mock()
distro.network_renderer = netplan.Renderer
distro.network_renderer = netplan.Renderer()
distro.dhcp_client.dhcp_discovery.return_value = {
"routers": "172.31.1.0"
}
Expand Down Expand Up @@ -1422,7 +1422,7 @@ def test_convert_ec2_metadata_network_config_multi_nics_ipv4_ipv6_multi_ip(
},
}
distro = mock.Mock()
distro.network_renderer = netplan.Renderer
distro.network_renderer = netplan.Renderer()
distro.dhcp_client.dhcp_discovery.return_value = {
"routers": "172.31.1.0"
}
Expand Down Expand Up @@ -1478,7 +1478,7 @@ def test_convert_ec2_metadata_network_config_multi_nics_ipv6_only(self):
},
}
distro = mock.Mock()
distro.network_renderer = netplan.Renderer
distro.network_renderer = netplan.Renderer()
assert expected == ec2.convert_ec2_metadata_network_config(
network_metadata, distro, macs_to_nics
)
Expand Down

0 comments on commit d771d1f

Please sign in to comment.