Forum: Cfengine Help
Subject: Delete_lines processed, but not insert_lines?
Author: bbomgardner
Link to topic: https://cfengine.com/forum/read.php?3,20432,20432#msg-20432
Today one of my v3.1.4 linux hosts decided to foul up the resolv.conf promise.
The resulting file did not have any nameservers listed, only a search domain.
Fancy!
There was no output recorded during this execution, but there is a
_etc_resolv.conf.cf-before-edit in my repository. From what I saw in the
runlog all of the locks were removed normally. And cf-execd has been running
fine since the upgrade to 3.1.4. I'm not sure where else to look for a clue as
to what happened.
It seemed to me that this promise was pretty solid. Do any seasoned cfengine
veterans have a hunch about how this could go wrong? (I'm starting to dislike
delete_lines more and more....)
bundle agent resolv
{
vars:
any::
"searchdomain" string => "domain.com";
ipv4_10_0::
"nameservers" slist => { "10.0.1.5", "10.0.1.6", "10.0.1.7" };
ipv4_10_1_1::
"nameservers" slist => { "10.1.1.2", "10.1.1.2" };
files:
"$(sys.resolv)"
handle => "name_resolution",
comment => "Ensure proper name resolution.",
edit_line =>
resolv_config("$(searchdomain)","@(this.nameservers)");
}
#########################################################
bundle edit_line resolv_config(search,list)
{
delete_lines:
!hpux::
"search.*" comment => "Reset search lines from resolver";
hpux::
"domain.*" comment => "Reset domain lines from resolver";
any::
"nameserver.*" comment => "Reset nameservers in resolver";
insert_lines:
!hpux::
"search $(search)" comment => "Add search domains to resolver";
hpux::
"domain $(search)" comment => "Add search domains to resolver";
any::
"nameserver $(list)" comment => "Add name servers to resolver";
}
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine