Hi,
I'm trying to use regular expressions to edit multiple files but
CFengine 3.2.1 only edits one file. Why isn't this working as I
expect? (I have 48 files in /tmp/etc that end in *.conf and I am
expecting CFEngine to insert my tagline into each of these 48 files.
But it only inserts it into one file.)
{{{
bundle agent example {
files:
"/tmp/etc/.*.conf"
edit_line => has_my_name_in_it,
pathtype => "regex",
comment => "Every *.conf file in /etc/ should have my name in
it. Demonstrate using regex to edi
t multiple files.";
}
bundle edit_line has_my_name_in_it {
insert_lines: "# This file proudly edited by Aleksey Tsalolikhin";
}
}}}
Verbose mode output shows:
cf3> *****************************************************************
cf3> BUNDLE example
cf3> *****************************************************************
cf3>
cf3>
cf3> + Private classes augmented:
cf3>
cf3> - Private classes diminished:
cf3>
cf3>
cf3>
cf3> =========================================================
cf3> files in bundle example (1)
cf3> =========================================================
cf3>
cf3>
cf3> .........................................................
cf3> Promise handle:
cf3> Promise made by: /tmp/etc/.*.conf
cf3>
cf3> Comment: Every *.conf file in /etc/ should have my name in
it. Demonstrate using regex to edit multiple files.
cf3> .........................................................
cf3>
cf3> -> Using regex pathtype for /tmp/etc/.*.conf (see pathtype)
cf3> -> Using expanded file base path /tmp/etc/warnquota.conf
cf3> -> Handling file existence constraints on /tmp/etc/warnquota.conf
cf3> -> Handling file edits in edit_line bundle has_my_name_in_it
cf3>
cf3> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
cf3> BUNDLE has_my_name_in_it
cf3> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
cf3>
cf3> Initiate variable convergence...
cf3> ?? Private class context
cf3>
cf3>
cf3> = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3> insert_lines in bundle has_my_name_in_it
cf3> = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3>
cf3>
cf3> .........................................................
cf3> Promise handle:
cf3> Promise made by: # This file proudly edited by Aleksey Tsalolikhin
cf3> .........................................................
cf3>
cf3> -> Promised line "# This file proudly edited by Aleksey
Tsalolikhin" exists within selected region of /tmp/etc/warnquota.conf
(promise kept)
cf3> ?? Private class context
cf3>
cf3>
cf3> = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3> insert_lines in bundle has_my_name_in_it
cf3> = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3>
cf3>
cf3> .........................................................
cf3> Promise handle:
cf3> Promise made by: # This file proudly edited by Aleksey Tsalolikhin
cf3> .........................................................
cf3>
cf3> -> This promise has already been verified
cf3> ?? Private class context
cf3>
cf3>
cf3> = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3> insert_lines in bundle has_my_name_in_it
cf3> = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3>
cf3>
cf3> .........................................................
cf3> Promise handle:
cf3> Promise made by: # This file proudly edited by Aleksey Tsalolikhin
cf3> .........................................................
cf3>
cf3> -> This promise has already been verified
cf3> -> No edit changes to file /tmp/etc/warnquota.conf need saving
cf3> -> Handling file existence constraints on /tmp/etc/warnquota.conf
cf3> -> Using expanded file base path /tmp/etc/nscd.conf
cf3> -> Handling file existence constraints on /tmp/etc/nscd.conf
cf3> -> This promise has already been verified
cf3> -> Handling file existence constraints on /tmp/etc/nscd.conf
cf3> -> Using expanded file base path /tmp/etc/syslog.conf
cf3> -> Handling file existence constraints on /tmp/etc/syslog.conf
cf3> -> This promise has already been verified
cf3> -> Handling file existence constraints on /tmp/etc/syslog.conf
cf3> -> Using expanded file base path /tmp/etc/dhcp6c.conf
cf3> -> Handling file existence constraints on /tmp/etc/dhcp6c.conf
cf3> -> This promise has already been verified
cf3> -> Handling file existence constraints on /tmp/etc/dhcp6c.conf
...
cf3> -> Using expanded file base path /tmp/etc/ldap.conf
cf3> -> Handling file existence constraints on /tmp/etc/ldap.conf
cf3> -> This promise has already been verified
cf3> -> Handling file existence constraints on /tmp/etc/ldap.conf
cf3>
cf3> + Private classes augmented:
cf3>
cf3> - Private classes diminished:
cf3>
cf3>
cf3>
cf3> =========================================================
cf3> files in bundle example (2)
cf3> =========================================================
Best,
Aleksey
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine