Forum: Cfengine Help
Subject: Re: How to modify a global list
Author: ticketo
Link to topic: https://cfengine.com/forum/read.php?3,21589,21595#msg-21595

Returning to the topic: Is it possible to modify a global slist?

I could use this if I want to keep a list of all cronjobs that should be 
present in root's crontab in memory and at the end of cfengine's execution I 
write them to disk.

Why?

Because by working with single "edit_line" statements in different bundles it 
is not possible to guarantee that the crontab (or any other file) is exactly as 
I'd like it to be. There may be extra junk, there may be misspelled commands, 
etc.

However if I start from scratch with an empty file and just add single lines 
scattered through different bundles, then this will never converge. If I 
collect all the lines that I want in memory and write them out in a single run, 
then I can make use of cfengines intelligent editing - the "intended" state is 
assembled in memory and only if "intended" and "current" differ then an actual 
edit happens and the file is being replaced.

This does not only apply to cron, where the issue could be evaded by using 
/etc/cron.d/ etc. It also applies to /etc/passwd, /etc/motd, /etc/fstab, 
/etc/hosts.(allow|deny), /etc/security/limits.conf or any other file that might 
be interesting to different users and/or applications.

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to