cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #06684
Re: [Merge] ~t0rrant/cloud-init:1819966-sysconfig-options into cloud-init:master
The best way to update the /etc/sysconfig/network contents with custom values is via the write_files in append mode.
A more robust solution would be to implement a config module: cc_sysconfig.py which could read in existing files from /etc/sysconfig, parse them with util.load_shell_content() which returns a dict of key=values; and let users provide new key/value:
sysconfig:
network:
mode: append # <update|append|overwrite>
content:
NTPSERVERARGS: "minpoll 3 maxpoll 3"
RES_OPTION: "rotate"
Append mode would merely append the KEY=VALUE pairs from the content dictionary in the file specified (/etc/sysconfig/network).
Update would replace the existing KEY with the new value, if KEY wasn't present, it would append it.
overwrite would allow writing a completely new file with the KEY/VALUE pairs provided.
Some challenges include retaining existing comments, indicating where cloud-init made changes within the file, handling interactions from cloudinit.net whose's renderers currently update/write values.
--
https://code.launchpad.net/~t0rrant/cloud-init/+git/cloud-init/+merge/371948
Your team cloud-init Commiters is requested to review the proposed merge of ~t0rrant/cloud-init:1819966-sysconfig-options into cloud-init:master.
References