Skip to content

Instantly share code, notes, and snippets.

@nickanderson
Created March 19, 2012 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickanderson/2124224 to your computer and use it in GitHub Desktop.
Save nickanderson/2124224 to your computer and use it in GitHub Desktop.
Difference between append_if_no_line and append_if_no_line
cmdln@ThinkPad-W520:~/.cfagent/inputs$ cf-agent -KIf ./test_append_lines.cf
-> Created file /tmp/test1, mode = 600
-> Edited file /tmp/test1
-> Created file /tmp/test2, mode = 600
-> Edited file /tmp/test2
-> Edited file /tmp/test2
-> Edited file /tmp/test2
cmdln@ThinkPad-W520:~/.cfagent/inputs$ cat /tmp/test1
L1i1
L1i2
L1i3
cmdln@ThinkPad-W520:~/.cfagent/inputs$ cat /tmp/test2
L1i1
L1i2
L1i3
body common control {
bundlesequence => {
"main",
};
inputs => {
"cfengine_stdlib.cf",
};
}
bundle agent main {
vars:
"list1" slist => { "L1i1", "L1i2", "L1i3" };
"list2" slist => { "L2i1", "L2i2", "L2i3" };
files:
"/tmp/test1"
create => "true",
edit_line => append_if_no_lines("@(main.list1)");
"/tmp/test2"
create => "true",
edit_line => append_if_no_line("$(list1)");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment