Davide,

your understanding is wrong, since Cfengine runs every bundle 3 times
to achieve convergence, so the config file will be downloaded in the
same cf-agent run once the desired package is installed and class is
set.

2010/9/17 Davide Brini <dave...@gmx.com>:
> On Friday 17 Sep 2010 10:27:06 Seva Gluschenko wrote:
>
>> While I disagree with Mark about usefulness of exit status (at least
>> of exit status 0 in this case), in case of packages, it's pretty easy
>> to check some vital file for existence as I stated already. I use such
>> a method to detect availability of a package, and it never harmed me.
>> Moreover, I use it like follows:
>>
>> classes:
>>        "ntpd_installed" expression => fileexists("/usr/sbin/ntpd");
>>
>> packages
>>     !ntpd_installed::
>>          "ntpd"
>>                 package_method => yum,
>>                 package_policy => "add";
>>
>> This approach saves me from wasting CPU and time for unnecessary
>> package manager invocation when a package is already installed.
>
> I'm already doing that to determine if the package needs to be installed and
> the package manager invoked.
>
> But I also have other things that depend upon the successful installation
> (copying a custom config file, basically). Currently, the config file is
> copied even if the package installation was unsuccessful, because it relies on
> a class being set only if the package manager was successful, but instead it's
> always set.
>
> I can however somewhat work around that using the same method:
>
> classes:
>      "ntpd_installed" expression => fileexists("/usr/sbin/ntpd");
>
> packages:
>    !ntpd_installed::
>         "ntpd"
>            package_method => yum,
>            package_policy => "add";
>
> files:
>    ntpd_installed::
>      "/etc/ntd.conf"
>         # copy the custom config file
>
>
> However my understanding is that this would require two agent invocations to
> get the intended configuration, the first would install the package, the
> second would copy the config file.
>
> --
> D.
>



-- 
SY, Seva Gluschenko.
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to