Simo Sorce wrote:

Instead of replacing the files altogether parse them and add only the
options we care about.

For ntp.conf those are the server related options.
For sysconfig/ntpd we care of adding just -x and -g if missing


nack, I don't think this will work.

A few comments on the python. You use some C-like syntax with match = 0, should probably be match = False (as you use elsewhere, with file_changed).

You don't need the string module to use split, so instead of:

opt = string.split(line, " ")

You can do:

opt = line.split(" ")

But what you really want, I think is:

opt = line.split()

If you split on None it splits on white space, not a single space. The different is:

>>> line = 'server     # local clock'
>>> line.split()
['server', '', '#', 'local', 'clock']
>>> line.split(' ')
['server', '', '', '', '', '', '', '#', 'local', 'clock']

Note the extra space after server in the last entry. This would cause your conditional to fail (if opt[1] == srv).

I'm not sure your loop for srv actually does the right thing. I wonder if you wanted to set match = 0 within the for loop.


Freeipa-devel mailing list

Reply via email to