I've put together a test bundle for this. Nova gives out these errors:
cf-promises -f ./foo.cf
Invalid mode string (${mod})
Problem validating a mode string
Promise (version not specified) belongs to bundle 'filecontents' in file
'./foo.cf' near line 50
Comment: ${cmt}
Unknown user ${usr}
Unknown group '${grp}'
Promise (version not specified) belongs to bundle 'filecontents' in file
'./foo.cf' near line 50
Comment: ${cmt}
Strangely Community V3.0.2 returns now errors or warnings. What do these
messages mean?
--
Neil Watson
Linux/UNIX Consultant
http://watson-wilson.ca
####################
body common control {
bundlesequence => { "test" };
}
bundle common g{
vars:
"masterfiles" string => "/var/cf-masterfiles";
"config" string => "${masterfiles}/config/trunk/";
"inputs" string => "${config}inputs";
"workdir" string => "/var/cfengine";
# for HA add more policy hosts
"phost" string => "192.168.0.1";
classes:
"all" expression => "any";
}
bundle agent test {
vars:
"trg[vimrc]" string => "/etc/vim/vimrc";
"src[vimrc]" string => "${g.config}vim/vimrc";
"mod[vimrc]" string => "0644";
"usr[vimrc]" string => "root";
"grp[vimrc]" string => "root";
"cmt[vimrc]" string => "Maintain global vimrc file.";
"files_list" slist => {
"vimrc"
};
methods:
"any" usebundle => filecontents(
"${trg[${files_list}]}",
"${src[${files_list}]}",
"${mod[${files_list}]}",
"${usr[${files_list}]}",
"${grp[${files_list}]}",
"${cmt[${files_list}]}"
);
}
bundle agent filecontents(trg, src, mod, usr, grp, cmt){
# Bundle to copy files and set permissions.
files:
"${trg}"
copy_from => mycopy("${src}"),
perms => system( "${mod}", "${usr}", "${grp}" ),
classes => cdefine( "${trg}_kept", "${trg}_repaired",
"${trg}_failed"),
comment => "${cmt}";
reports:
all::
"ALARM: ${trg} wrong contents or perms ${mod}, ${usr}, ${grp}",
ifvarclass => canonify("${trg}_failed");
"${trg} correct contents and perms ${mod}, ${usr}, ${grp}",
ifvarclass => canonify("${trg}_kept");
"WARNING: ${trg} fixed contents or perms ${mod}, ${usr}, ${grp}",
ifvarclass => canonify("${trg}_repaired");
}
body perms system(m,u,g) {
mode => "${m}";
owners => { "${u}" };
groups => { "${g}" };
}
body action warn_now{
action_policy => "warn";
log_level => "inform";
background => "true";
}
body classes cdefine (k,r,f){
promise_kept => {canonify("${k}")};
promise_repaired => {canonify("${r}")};
repair_failed => {canonify("${f}")};
}
body copy_from mycopy(from) {
source => "${from}";
servers => { "${g.phost}" };
compare => "digest";
}
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine