support NTPSERVERARGS in /etc/sysconfig/network

Bug #1819966 reported by Brendan Germain
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cloud-init
Expired
Medium
Unassigned

Bug Description

I'm not sure what's changed but in previous versions of cloud-init, it was not owning/writing contents to /etc/sysconfig/network.

I DHCP my ntp endpoints and provide ntp options via NTPSERVERARGS. Example:

echo 'NTPSERVERARGS="minpoll 3 maxpoll 4"' >> /etc/sysconfig/network

$ grep server /etc/ntp.conf
server 10.155.55.1 minpoll 3 maxpoll 4 # added by /sbin/dhclient-script

On boot now /etc/sysconfig/network only has:
$ cat /etc/sysconfig/network
# Created by cloud-init on instance boot automatically, do not edit.
#
NETWORKING=yes

So how can i prevent cloud-init from modifying it, or have it write the additional option (NTPSERVERARGS) that i need?

Related branches

Revision history for this message
Ryan Harper (raharper) wrote :

Hello,

Thanks for file a bug. Cloud-init has included a sysconfig renderer for quite some time. It does indeed render the contents of /etc/sysconfig/network.

The sysconfig renderer doesn't currently support adding additional values through the network configuration format.

We should see if we can read/update the contents of the file instead of writing one from scratch.
There is an existing update_sysconfig_file, so we should take a look at using that instead.

Changed in cloud-init:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Manuel Torrinha (t0rrant) wrote :

This also denies users from adding options like:

  RES_OPTIONS="rotate"

which can be useful in scenarios where multiple networks have different
nameservers for each network.

Revision history for this message
Dan Watkins (oddbloke) wrote :

Hi Manuel,

Thanks for the additional information! It sounds like this bug affects you, would you be interested in looking into contributing a fix for it?

Thanks!

Dan

Revision history for this message
Manuel Torrinha (t0rrant) wrote :

Hi Dan,

I'll take a look next week and see what I can do.

If in the meantime someone else comes up with a solution, even better.

Any considerations I should have besides the instructions in:

  https://cloudinit.readthedocs.io/en/latest/topics/hacking.html

i.e: good practices for contributing.

Cheers,
Manuel

Revision history for this message
Dan Watkins (oddbloke) wrote :

Hi Manuel,

That's certainly a great place to start! For this particular bug, I expect that the `cloud-init devel net-convert` command (https://cloudinit.readthedocs.io/en/latest/topics/network-config.html#network-configuration-tools) would be useful; that will allow you to iterate on the network configuration generation code without having to build a cloud-init package, install it in an instance and reboot. (You should be able to run this from your development environment, if you install cloud-init into a virtualenv, for example. Don't install cloud-init at the system level on your development machine!)

The team is generally around in #cloud-init on Freenode, if you have any further questions. (FYI, the cloud-init team happens to be largely North America based, so the most activity from core team members is in US working hours.)

Thanks!

Dan

Revision history for this message
James Falcon (falcojr) wrote :
Changed in cloud-init:
status: Confirmed → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.