Hi,

I came across an odd feature when trying local_cp with a non existant 
file, on an already existing file

r...@cfserveur:/home/nicolas# ls -al cf-served.cf
-rw-r--r-- 1 nicolas nicolas 797 2009-08-27 18:46 cf-served.cf

error.cf :
##################################
body common control {
    bundlesequence => { "copy_file"};

    inputs => {"cfengine_stdlib.cf"};
}


bundle agent copy_file {

files:
  "/home/nicolas/cf-served.cf"
    copy_from => local_cp("a really non existing file"),
    perms => m("644"),
    action => immediate,
    classes => repaired_or_not("copied", "couldntCopy");
}



body classes repaired_or_not(yes, no)
{
  promise_kept => { "$(yes)" };
  promise_repaired => { "$(yes)" };

  repair_failed   => { "$(no)" };
  repair_denied   => { "$(no)" };
  repair_timeout  => { "$(no)" };
}
###################################


r...@cfserveur:/home/nicolas/copiefichier# cf-agent -Kvf ./error.cf
(snip)
Validation: Scalar item in source => { a really non existing file } in 
rvalue is out of bounds (value should match pattern ("?[a-zA-Z]:\\.*)|(/.*))

(snip)
cf3
cf3  -> Handling file existence constraints on /home/nicolas/cf-served.cf
cf3  -> File permissions on /home/nicolas/cf-served.cf as promised
cf3  ?> defining promise result class copied
cf3  -> Handling file existence constraints on /home/nicolas/cf-served.cf
cf3  -> File permissions on /home/nicolas/cf-served.cf as promised
cf3  ?> defining promise result class copied
cf3  -> Copy file /home/nicolas/cf-served.cf from a really non existing 
file check
cf3 Can't stat a really non existing file in files.copyfrom promise
cf3  ?> defining promise result class couldntCopy
(snip)


So I end up with both promise_kept and promise_repaired, even though it 
can not be promised

Regards
Nicolas


_______________________________________________
Bug-cfengine mailing list
Bug-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to