Ryan,
the idea of having two records with the same IP in /etc/hosts is not
convergent, speaking in terms of the Cfengine. But, if you're
explicitly need that, the solution would be like
bundle edit_line etc_hosts
{
classes:
"ok" or => {
regline("10.1.1.4\s+myserver", "$(edit.filename)"),
regline("10.1.1.4\s+foo", "$(edit.filename)")
};
delete_lines:
!ok::
"10.1.1.4\s+.*" comment => "remove entries";
insert_lines:
!ok::
"10.1.1.4 myserver
10.1.1.4 foo"
comment => "(re)insert entires";
}
2010/8/10 Anderson, Ryan C (US SSA) <[email protected]>:
> My current cf2 implementation updates /etc/hosts, and the syntax it uses
> deletes lines that don't match exactly. I'm having a hard time converting
> this cf2 logic to cf3:
>
> editfiles:
>
> sunos_5_10::
>
> { /etc/hosts
>
> BeginGroupIfNoSuchLine "10.1.1.4 myserver"
>
> DeleteLinesStarting "10.1.1.4"
>
> AppendIfNoSuchLine "10.1.1.4 myserver"
>
> EndGroup
>
> }
>
>
>
> I can insert or append lines in cf3, but I can't convert this extra error
> check logic that prevents having two different hostnames with the same IP
> address. Any guidance is appreciated.
>
>
>
> RCA
>
> --
>
> UNIX Administrator, BAE Systems EIT
> desk 763-572-6684 mobile 612-419-9362
>
>
>
> _______________________________________________
> Help-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/help-cfengine
>
>
--
SY, Seva Gluschenko.
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine