summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsdc <taras@vyos.io>2023-02-16 18:13:19 +0200
committerzsdc <taras@vyos.io>2023-02-16 18:13:19 +0200
commit72f61df7e60670f4546128a711e8a521dcd81615 (patch)
tree427427e03213b926aca7a6d5ebf2c0d07cc4d694
parent330c88b626b92533f2812c2f1628777623ac2922 (diff)
downloadvyos-cloud-init-72f61df7e60670f4546128a711e8a521dcd81615.tar.gz
vyos-cloud-init-72f61df7e60670f4546128a711e8a521dcd81615.zip
network: T5012: Added a new option for network-config control
A new option for Cloud-Init was added: ``` vyos_config_options: network_config: <disabled/enabled> ``` Possible values: * by default - equal to the `network['config']` from the active Cloud-Init configuration * `enabled` - configure networking, even if global `network['config']` is set to `disabled` * `disabled` - do not configure networking, regardless of global `network['config']` value
-rw-r--r--cloudinit/config/cc_vyos.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/cloudinit/config/cc_vyos.py b/cloudinit/config/cc_vyos.py
index ffffe0b0..a54c9980 100644
--- a/cloudinit/config/cc_vyos.py
+++ b/cloudinit/config/cc_vyos.py
@@ -1089,8 +1089,16 @@ def handle(name, cfg, cloud, log, _args):
hostname = None
network_configured = True
+ # get network-config control options
+ network_config_global: str = get_cfg_by_path(cfg, 'network/config', '')
+ network_config_vyos: str = get_cfg_by_path(
+ cfg, 'vyos_config_options/network_config', network_config_global)
+ if network_config_vyos == 'disabled':
+ logger.debug("Network-config is disabled (global/vyos): {}/{}".format(
+ network_config_global, network_config_vyos))
+
# process networking configuration data
- if netcfg and network_configured is False:
+ if netcfg and network_configured is False and network_config_vyos != 'disabled':
# check which one version of config we have
# version 1
if netcfg['version'] == 1: