Well spotted, Nicholas,
A missing registration. Adding to svn a fix
M
Nicolas Charles wrote:
> Consider the following example
>
> bundle agent createfolder {
>
> files:
> "/home/nicolas/foo/."
> create => "true",
> comment => "Creating directory",
> classes => if_else("foldercreated", "failure");
>
> commands:
> foldercreated::
> "/bin/echo \"Folder created or present\"";
>
> failure::
> "/bin/echo \"Failure\"";
>
> }
>
> body classes if_else(if, else) {
> promise_repaired => {"foldercreated"};
> promise_kept => {"foldercreated"};
> repair_failed => {"$(else)"};
> }
>
>
>
> It should create the folder foo if it doesn't exist, and set the class
> foldercreated. But it doesn't (latest trunk build and cf3.0.2)
>
> Output if folder doesn't exist :
> cf3 Verifying SQL table promises is only available with Cfengine Nova or
> above
> cf3
> cf3 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> cf3 Skipping whole next promise (/bin/echo "Folder created or present"),
> as context foldercreated is not relevant
> cf3 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> cf3
> cf3 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> cf3 Skipping whole next promise (/bin/echo "Failure"), as context
> failure is not relevant
> cf3 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> cf3
> cf3 =========================================================
> cf3 files in bundle createfolder (1)
> cf3 =========================================================
> cf3
> cf3 Verifying SQL table promises is only available with Cfengine Nova or
> above
> cf3
> cf3 .........................................................
> cf3 Promise handle:
> cf3 Promise made by: /home/nicolas/foo/.
> cf3
> cf3 Comment: Creating directory
> cf3 .........................................................
> cf3
> cf3 -> Using literal pathtype for /home/nicolas/foo/.
> cf3
> cf3 + Private classes augmented:
> cf3
> cf3 - Private classes diminished:
> cf3
> cf3
> cf3
> cf3 =========================================================
> cf3 commands in bundle createfolder (2)
> cf3 =========================================================
> cf3
> cf3 Verifying SQL table promises is only available with Cfengine Nova or
> above
> cf3
> cf3 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> cf3 Skipping whole next promise (/bin/echo "Folder created or present"),
> as context foldercreated is not relevant
> cf3 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> cf3
> cf3 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> cf3 Skipping whole next promise (/bin/echo "Failure"), as context
> failure is not relevant
> cf3 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>
>
>
>
> Output if folder exists:
>
> cf3 Verifying SQL table promises is only available with Cfengine Nova or
> above
> cf3
> cf3 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> cf3 Skipping whole next promise (/bin/echo "Folder created or present"),
> as context foldercreated is not relevant
> cf3 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> cf3
> cf3 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> cf3 Skipping whole next promise (/bin/echo "Failure"), as context
> failure is not relevant
> cf3 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> cf3
> cf3 =========================================================
> cf3 files in bundle createfolder (1)
> cf3 =========================================================
> cf3
> cf3 Verifying SQL table promises is only available with Cfengine Nova or
> above
> cf3
> cf3 .........................................................
> cf3 Promise handle:
> cf3 Promise made by: /home/nicolas/foo/.
> cf3
> cf3 Comment: Creating directory
> cf3 .........................................................
> cf3
> cf3 -> Using literal pathtype for /home/nicolas/foo/.
> cf3 -> File /home/nicolas/foo/. exists as promised
> cf3 ?> defining promise result class foldercreated
> cf3 -> Handling file existence constraints on /home/nicolas/foo/.
> cf3
> cf3 + Private classes augmented:
> cf3
> cf3 - Private classes diminished:
> cf3
> cf3
> cf3
> cf3 =========================================================
> cf3 commands in bundle createfolder (2)
> cf3 =========================================================
> cf3
> cf3 Verifying SQL table promises is only available with Cfengine Nova or
> above
> cf3 -> Promiser string contains a valid executable (/bin/echo) - ok
> cf3
> cf3 .........................................................
> cf3 Promise handle:
> cf3 Promise made by: /bin/echo "Folder created or present"
> cf3 .........................................................
> cf3
> cf3 -> Executing '/bin/echo "Folder created or present"'
> ...(timeout=0,owner=-1,group=-1)
> cf3 -> (Setting umask to 77)
> cf3 Q: ".../bin/echo "Fold": Folder created or present
> cf3 -> Finished script - succeeded /bin/echo "Folder created or present"
> cf3 I: Last 1 QUOTEed lines were generated by promiser "/bin/echo
> "Folder created or present""
> cf3 I: Report relates to a promise with handle ""
> cf3 I: Made in version 'not specified' of './createfolder.cf' near line 18
> cf3 -> Completed execution of /bin/echo "Folder created or present"
> cf3
> cf3 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> cf3 Skipping whole next promise (/bin/echo "Failure"), as context
> failure is not relevant
> cf3 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>
>
>
>
> Using "/home/nicolas/foo/" as a temporary workaround: it failed for it
> is not a file, but a folder, and at the next iteration the folder is
> there, so the promise is kept
>
> 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