I have a promise that used tidy but in a warn only manner. In spite of
this files are still being deleted.
######################
body common control {
bundlesequence => { "test" };
}
bundle common g{
vars:
"masterfiles" string => "/var/cf-masterfiles";
"inputs" string => "${masterfiles}/config/inputs";
"workdir" string => "/var/cfengine";
# Duplicate phost rules in update.cf
"phost" string => "unxxhd01.example.com";
classes:
"all" expression => "any";
}
bundle agent test {
files:
"/tmp/foo"
delete => tidy,
action => warn_now,
classes => cdefine(
"/tmp/foo_kept",
"/tmp/foo_repaired",
"/tmp/foo_failed"
),
comment => "Delete files, warn only.";
reports:
all::
"foo not present.",
ifvarclass => canonify("/tmp/foo_kept");
"WARNING: /tmp/foo was removed.",
ifvarclass => canonify("/tmp/foo_repaired");
"ALARM: /tmp/foo could not be removed.",
ifvarclass => canonify("/tmp/foo_failed");
}
body delete tidy {
dirlinks => "delete";
rmdirs => "true";
}
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}")};
}
[r...@unxxhd01 inputs]# !touch
touch /tmp/foo
[r...@unxxhd01 inputs]# !ls
ls -l /tmp/foo
-rw-r--r-- 1 root root 0 Dec 7 10:34 /tmp/foo
[r...@unxxhd01 inputs]# cf-agent -Kf ./foo.cf
R: WARNING: /tmp/foo was removed.
R: ALARM: /tmp/foo could not be removed.
[r...@unxxhd01 inputs]# !ls
ls -l /tmp/foo
ls: /tmp/foo: No such file or directory
Sincerely,
--
Neil Watson
416-673-3465
CONFIDENTIALITY WARNING
This communication, including any attachments, is for the exclusive use of
addressee and may contain proprietary and/or confidential information. If you
are not the intended recipient, any use, copying, disclosure, dissemination or
distribution is strictly prohibited. If you are not the intended recipient,
please notify the sender immediately by return e-mail, delete this
communication and destroy all copies.
AVERTISSEMENT RELATIF À LA CONFIDENTIALITÉ
Ce message, ainsi que les pièces qui y sont jointes, est destiné à l’usage
exclusif de la personne à laquelle il s’adresse et peut contenir de
l’information personnelle ou confidentielle. Si le lecteur de ce message n’en
est pas le destinataire, nous l’avisons par la présente que toute diffusion,
distribution, reproduction ou utilisation de son contenu est strictement
interdite. Veuillez avertir sur-le-champ l’expéditeur par retour de courrier
électronique et supprimez ce message ainsi que toutes les pièces jointes.
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine