summaryrefslogtreecommitdiff
path: root/cloudinit/sources/__init__.py
diff options
context:
space:
mode:
authorDaniel Watkins <daniel.watkins@canonical.com>2019-07-26 20:40:18 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2019-07-26 20:40:18 +0000
commit496aaa947ec563bd02b3148f220ff0afe1b32abb (patch)
tree447ccd21a9d67a69ba40eae215feabf8039c6383 /cloudinit/sources/__init__.py
parent1dbede64dc645b090b4047a105143b5d5090d214 (diff)
downloadvyos-cloud-init-496aaa947ec563bd02b3148f220ff0afe1b32abb.tar.gz
vyos-cloud-init-496aaa947ec563bd02b3148f220ff0afe1b32abb.zip
net/cmdline: split interfaces_by_mac and init network config determination
Previously "cmdline" network configuration could be either user-specified network-config=... configuration data, or initramfs-provided configuration data. Before data sources could modify the order in which network config sources were considered, this conflation didn't matter (and, indeed, in the default data source configuration it will continue to not matter). However, it _is_ desirable for a data source to be able to specify that its network configuration should be preferred over the initramfs-provided network configuration but still allow explicit network-config=... configuration passed to the kernel cmdline to continue to override both of those sources. (This also modifies the Oracle data source to use read_initramfs_config directly, which is effectively what it was using read_kernel_cmdline_config for previously.)
Diffstat (limited to 'cloudinit/sources/__init__.py')
-rw-r--r--cloudinit/sources/__init__.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
index 9d249366..c2baccd5 100644
--- a/cloudinit/sources/__init__.py
+++ b/cloudinit/sources/__init__.py
@@ -69,7 +69,7 @@ CLOUD_ID_REGION_PREFIX_MAP = {
# NetworkConfigSource represents the canonical list of network config sources
# that cloud-init knows about. (Python 2.7 lacks PEP 435, so use a singleton
# namedtuple as an enum; see https://stackoverflow.com/a/6971002)
-_NETCFG_SOURCE_NAMES = ('cmdline', 'ds', 'system_cfg', 'fallback')
+_NETCFG_SOURCE_NAMES = ('cmdline', 'ds', 'system_cfg', 'fallback', 'initramfs')
NetworkConfigSource = namedtuple('NetworkConfigSource',
_NETCFG_SOURCE_NAMES)(*_NETCFG_SOURCE_NAMES)
@@ -166,6 +166,7 @@ class DataSource(object):
# should always be a subset of the members of NetworkConfigSource with no
# duplicate entries.
network_config_sources = (NetworkConfigSource.cmdline,
+ NetworkConfigSource.initramfs,
NetworkConfigSource.system_cfg,
NetworkConfigSource.ds)