diff options
author | Dimitri John Ledkov <xnox@ubuntu.com> | 2017-09-30 00:00:18 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-10-03 08:59:43 -0400 |
commit | 9d2a87dc386b7aed1a8243d599676e78ed358749 (patch) | |
tree | 9d24ff110b5a08d6cdaf6e37023feb9abe7a9ec9 /tests/unittests/test_datasource/test_cloudstack.py | |
parent | 946232bb9eda2f4bc66c4464db9e72d3edfd9900 (diff) | |
download | vyos-cloud-init-9d2a87dc386b7aed1a8243d599676e78ed358749.tar.gz vyos-cloud-init-9d2a87dc386b7aed1a8243d599676e78ed358749.zip |
Azure, CloudStack: Support reading dhcp options from systemd-networkd.
Systems that used systemd-networkd's dhcp client would not be able to get
information on the Azure endpoint (placed in Option 245) or the CloudStack
server (in 'server_address').
The change here supports reading these files in /run/systemd/netif/leases.
The files declare that "This is private data. Do not parse.", but at this
point we do not have another option.
LP: #1718029
Diffstat (limited to 'tests/unittests/test_datasource/test_cloudstack.py')
-rw-r--r-- | tests/unittests/test_datasource/test_cloudstack.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/unittests/test_datasource/test_cloudstack.py b/tests/unittests/test_datasource/test_cloudstack.py index 8e98e1bb..96144b64 100644 --- a/tests/unittests/test_datasource/test_cloudstack.py +++ b/tests/unittests/test_datasource/test_cloudstack.py @@ -23,13 +23,16 @@ class TestCloudStackPasswordFetching(CiTestCase): default_gw = "192.201.20.0" get_latest_lease = mock.MagicMock(return_value=None) self.patches.enter_context(mock.patch( - 'cloudinit.sources.DataSourceCloudStack.get_latest_lease', - get_latest_lease)) + mod_name + '.get_latest_lease', get_latest_lease)) get_default_gw = mock.MagicMock(return_value=default_gw) self.patches.enter_context(mock.patch( - 'cloudinit.sources.DataSourceCloudStack.get_default_gateway', - get_default_gw)) + mod_name + '.get_default_gateway', get_default_gw)) + + get_networkd_server_address = mock.MagicMock(return_value=None) + self.patches.enter_context(mock.patch( + mod_name + '.dhcp.networkd_get_option_from_leases', + get_networkd_server_address)) def _set_password_server_response(self, response_string): subp = mock.MagicMock(return_value=(response_string, '')) |