Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cloudinit/sources/DataSourceUpCloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def network_config(self):
due to reconfiguration.
"""

if self._network_config:
if self._network_config and self._network_config != sources.UNSET:
return self._network_config

raw_network_config = self.metadata.get("network")
Expand Down
7 changes: 7 additions & 0 deletions tests/unittests/sources/test_upcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,13 @@ def test_network_configuration(self, m_get_by_mac, mock_readmd, ds):
UC_METADATA.get("network").get("dns")[1] == dns.get("address")[1]
)

# GH-7067: Verify recomputation when _network_config is UNSET

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want a distinct unittest for this. It's not as discoverable when added to the middle of an existing test.

ds._network_config = sources.UNSET
recomputed_netcfg = ds.network_config
assert recomputed_netcfg != sources.UNSET
assert isinstance(recomputed_netcfg, dict)
assert 1 == recomputed_netcfg.get("version")


class TestUpCloudDatasourceLoading:
def test_get_datasource_list_returns_in_local(self):
Expand Down
Loading