Forum: Cfengine Help Subject: Best practice in edit_lines Author: pieterb Link to topic: https://cfengine.com/forum/read.php?3,18695,18695#msg-18695
There a certain files where I want to make sure there is only one definition of a certain attribute. For example, in /etc/nsswitch.conf, I want only one instance of the line: "passwd ldap files". The way I currently do this is search the whole file, delete all entries that start with passwd, and then add the right one again. This is to make sure only that specific entry is in my nsswitch file. I feel however that this is a pretty dirty way to do this; there is a small window in which there is nothing defined in the file (e.g., step one deleted all lines starting with .., but not added the correct one yet) that makes me a bit uncomfortable. How do you guys go about this? _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine