Forum: Cfengine Help
Subject: edit_line on a symlink
Author: Norbert
Link to topic: https://cfengine.com/forum/read.php?3,20423,20423#msg-20423
Hi all
I'm using 3.0.5p1 and have the following problem. I'd like to edit a file, but
this file may is a plain file or a symlink.
Editing of a plain file is done perfect, but if it is a symlink, the link is
replaced by a plain file after modification.
But that's not exactly what i want.
Is there a way that cfengine follows the symlink to the file and edit the real
one ?
code:
files:
"/etc/xyz.conf"
edit_line => search_and_replace("oldtext","newtext","all"),
edit_defaults => modify;
bundle edit_line search_and_replace(searchpattern, replacepattern, sr_flag)
{
replace_patterns:
"$(searchpattern)" replace_with =>
with_new("$(replacepattern)","$(sr_flag)");
}
body replace_with with_new(newvalue, wn_flag)
{
replace_value => "$(newvalue)";
occurrences => "$(wn_flag)";
}
body edit_defaults modify
{
empty_file_before_editing => "false";
edit_backup => "false";
}
Regards
Norbert
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine