summaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
authorDaniel Watkins <daniel.watkins@canonical.com>2019-07-23 22:07:11 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2019-07-23 22:07:11 +0000
commit1dbede64dc645b090b4047a105143b5d5090d214 (patch)
tree81f7d13801cbd629712236679d3b1caa08226d67 /tests/unittests
parenta02c0c9aa24a16f1983a81fe5dbfadac3d7e0ad3 (diff)
downloadvyos-cloud-init-1dbede64dc645b090b4047a105143b5d5090d214.tar.gz
vyos-cloud-init-1dbede64dc645b090b4047a105143b5d5090d214.zip
stages: allow data sources to override network config source order
Currently, if a platform provides any network configuration via the "cmdline" method (i.e. network-data=... on the kernel command line, ip=... on the kernel command line, or iBFT config via /run/net-*.conf), the value of the data source's network_config property is completely ignored. This means that on platforms that use iSCSI boot (such as Oracle Compute Infrastructure), there is no way for the data source to configure any network interfaces other than those that have already been configured by the initramfs. This change allows data sources to specify the order in which network configuration sources are considered. Data sources that opt to use this mechanism will be expected to consume the command line network data and integrate it themselves. (The generic merging of network configuration sources was considered, but we concluded that the single use case we have presently (a) didn't warrant the increased complexity, and (b) didn't give us a broad enough view to be sure that our generic implementation would be sufficiently generic. This change in no way precludes a merging strategy in future.)
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/test_datasource/test_common.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unittests/test_datasource/test_common.py b/tests/unittests/test_datasource/test_common.py
index 6b01a4ea..2a9cfb29 100644
--- a/tests/unittests/test_datasource/test_common.py
+++ b/tests/unittests/test_datasource/test_common.py
@@ -83,4 +83,15 @@ class ExpectedDataSources(test_helpers.TestCase):
self.assertEqual(set([AliYun.DataSourceAliYun]), set(found))
+class TestDataSourceInvariants(test_helpers.TestCase):
+
+ def test_data_sources_have_valid_network_config_sources(self):
+ for ds in DEFAULT_LOCAL + DEFAULT_NETWORK:
+ for cfg_src in ds.network_config_sources:
+ fail_msg = ('{} has an invalid network_config_sources entry:'
+ ' {}'.format(str(ds), cfg_src))
+ self.assertTrue(hasattr(sources.NetworkConfigSource, cfg_src),
+ fail_msg)
+
+
# vi: ts=4 expandtab