summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorasakkurr <asakkurr@microsoft.com>2018-11-12 17:16:09 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2018-11-12 17:16:09 +0000
commitd910ecd15de642d73a36e935704e54370f93c45b (patch)
tree03a33a7165781298692d1634950d9aa5bf9dc95d /tests
parent3b332c93f765c9208f7e059d8a0c2463f7ffe12a (diff)
downloadvyos-cloud-init-d910ecd15de642d73a36e935704e54370f93c45b.tar.gz
vyos-cloud-init-d910ecd15de642d73a36e935704e54370f93c45b.zip
azure: fix regression introduced when persisting ephemeral dhcp lease
In commitish 9073951 azure datasource tried to leverage stale DHCP information obtained from EphemeralDHCPv4 context manager to report updated provisioning status to the fabric earlier in the boot process. Unfortunately the stale ephemeral network configuration had already been torn down in preparation to bring up IMDS network config so the report attempt failed on timeout. This branch introduces obtain_lease and clean_network public methods on EphemeralDHCPv4 to allow for setup and teardown of ephemeral network configuration without using a context manager. Azure datasource now uses this to persist ephemeral network configuration across multiple contexts during provisioning to avoid multiple DHCP roundtrips.
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test_datasource/test_azure.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py
index 4c5c6c12..1dc69adb 100644
--- a/tests/unittests/test_datasource/test_azure.py
+++ b/tests/unittests/test_datasource/test_azure.py
@@ -513,6 +513,7 @@ fdescfs /dev/fd fdescfs rw 0 0
dsrc.crawl_metadata()
self.assertEqual(str(cm.exception), error_msg)
+ @mock.patch('cloudinit.sources.DataSourceAzure.EphemeralDHCPv4')
@mock.patch('cloudinit.sources.DataSourceAzure.util.write_file')
@mock.patch(
'cloudinit.sources.DataSourceAzure.DataSourceAzure._report_ready')
@@ -520,7 +521,7 @@ fdescfs /dev/fd fdescfs rw 0 0
def test_crawl_metadata_on_reprovision_reports_ready(
self, poll_imds_func,
report_ready_func,
- m_write):
+ m_write, m_dhcp):
"""If reprovisioning, report ready at the end"""
ovfenv = construct_valid_ovf_env(
platform_settings={"PreprovisionedVm": "True"})