Hi all
I am trying to check for some records in the /etc/hosts file. More
specifically, I want that:
1) There must be only one line matching
"^$(sys.ipv4)\s+$(fqhost)\s+$(uqhost)\b.*$"
I don't care if other names are added after the two canonical ones, in
that order.
2) If there are other lines matching either "^$(sys.ipv4)\b", or
"\b$(fqhost)\b", or "\b$(uqhost)\b", they must be removed
In an attempt to do that, I tried to use readstringlist() to read the
file in memory, and reglist() to match the records, define classes, and
take action. The problem is that regexes in reglist() do *not* expand
scalars, so I can't say:
classes:
"has_host_ipv4_record"
expression =>
reglist("@(records)",
"$(sys.ipv4)\s+$(fqhost)\s+$(uqhost)\b.*") ;
(I know that $(sys.ipv4) must be escaped, but let's close our eyes for a
second...)
Is it possible to force variable expansion before reglist gets to that
string?
If not, what's one possible way to do it?
Thanks
-- bronto
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine