Using CFEngine 3.2.1,  I've observed that the promise_kept classes
attribute is not getting set on files type promises when there are no
attributes.  Either that, I don't misunderstand files type promises,
in which case I'd like to clear that up, please.


Doesn't   {{{ files:  "/tmp/filename"; }}} mean that /tmp/filename
promises to continue to exist?  (But not to be auto-created if it does
not exist?)

Based on that assumption,I tried to chain two promises together, to
install the Fedora RPM that provides the YUM configuration to enable
the EPEL (Extra Packages for Enterprise Linux) repository, but
apparently CFEngine does not consider it a promise_kept if the file is
already there:


### start test.cf ###

body common control {

        inputs => { "/var/cfengine/inputs/cfengine_stdlib.cf" };
}

bundle agent epel_repo_is_installed {

files:

    "/etc/yum.repos.d/epel.repo"

       classes =>  if_ok("epel_repo_is_installed");


reports:

  !epel_repo_is_installed::

    "EPEL RPM is not installed.  We need to install it.";

}

### end test.cf ###


# ls /etc/yum.repos.d/epel.repo
/etc/yum.repos.d/epel.repo
# cf-agent -f ./test.cf -b epel_repo_is_installed -K
R: EPEL RPM is not installed.  We need to install it.
#

I've replaced the files type promise with

{{{

classes:

    "epel_repo_is_installed"

           expression => fileexists("/etc/yum.repos.d/epel.repo");

}}}

which has the advantage of expressing my intention very clearly but
I'd like to understand why the files type promise did not behave as I
expected.

Do I misunderstand something, or am I running into a corner case or
unexpected use of the language?

Best,
-at
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to