The problem here is that you make several promises in one. So part of the
promise
succeeded and therefore this is reported ok. This issue has come up before, but
it
is unclear how to solve this problem generally at present.
No solution is expected in the near future. A work around is to split the
promise into
separate perms, copy, etc
Nicolas Charles wrote:
> 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
> [email protected]
> https://cfengine.org/mailman/listinfo/bug-cfengine
--
Mark Burgess
-------------------------------------------------
Professor of Network and System Administration
Oslo University College, Norway
Personal Web: http://www.iu.hio.no/~mark
Office Telf : +47 22453272
-------------------------------------------------
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine