Manuel Torrinha has proposed merging ~t0rrant/cloud-init:1819966-sysconfig-options into cloud-init:master.
Commit message: Added support for arbitrary options in sysconfig These options should be added within the `sysconfig` key, as such: ``` network: version: 2 sysconfig: NTPSERVERARGS: "minpoll 3 maxpoll 4" RES_OPTIONS: "rotate" ``` LP: #1819966 Signed-off-by: Manuel Torrinha <manuel.torri...@tecnico.ulisboa.pt> Requested reviews: cloud-init commiters (cloud-init-dev) For more details, see: https://code.launchpad.net/~t0rrant/cloud-init/+git/cloud-init/+merge/371948 I do not feel comfortable with having a dummy handler for this, I guess the purpose of the `network` key is exclusive for network interfaces and network interface interaction. Having a handle_ function is perhaps not the best choice. For now this does what is intended, will eventually discuss this with the cloud-init team and maybe this will be done in some other way. On a final note, when running tox tests I get several errors/warnings, however: ``` ... Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00) ``` -- Your team cloud-init commiters is requested to review the proposed merge of ~t0rrant/cloud-init:1819966-sysconfig-options into cloud-init:master.
diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py index c0c415d..a15df67 100644 --- a/cloudinit/net/network_state.py +++ b/cloudinit/net/network_state.py @@ -652,6 +652,14 @@ class NetworkStateInterpreter(object): LOG.debug('v2(ethernets) -> v1(physical):\n%s', phy_cmd) self.handle_physical(phy_cmd) + def handle_sysconfig(self, command): + ''' + sysconfig: + NTPSERVERARGS: "minpoll 3 maxpoll 4" + RES_OPTIONS: "rotate" + ''' + LOG.debug('[handle_sysconfig] %s', command.items()) + def handle_vlans(self, command): ''' v2_vlans = { diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py index be5dede..c608d68 100644 --- a/cloudinit/net/sysconfig.py +++ b/cloudinit/net/sysconfig.py @@ -724,6 +724,10 @@ class Renderer(renderer.Renderer): if network_state.use_ipv6: netcfg.append('NETWORKING_IPV6=yes') netcfg.append('IPV6_AUTOCONF=no') + if network_state.config and network_state.config['sysconfig']: + for opt, val in network_state.config['sysconfig'].items(): + netcfg.append("{}=\"{}\"".format(opt, val)) + util.write_file(sysconfig_path, "\n".join(netcfg) + "\n", file_mode)
_______________________________________________ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp