Forum: CFEngine Help
Subject: cf_null; truly empty lists, etc.
Author: davidlee
Link to topic: https://cfengine.com/forum/read.php?3,23642,23642#msg-23642

Using cfengine-community 3.1.4 on RHEL 5.x

Across a wide range of machines we want to install different packages depending 
on the machine's role, etc.  So we have:
----------
  vars:
    role_ABC::
      "pkgs_ABC" slist => {
        "pkg_ABC_1", "pkg_ABC_2",
      };

    role_PQR::
      "pkgs_PQR" slist => {
        "pkg_PQR_1", "pkg_PQR_2",
      };

    ### Collect all the above, if defined.
    all_hosts::
      "all_packages" slist => {
        "@(pkgs_ABC)", "@(pkgs_PQR)",
     },
      policy => "ifdefined";

  ### Now install them.  There may be none.
  packages:
    all_hosts::
      "$(all_packages)"
        package_policy => "update",
        package_method => yum;
----------

So an ABC-only machine gets only the "pkgs_ABC" packages;  a PQR-only machine 
gets "pkgs_PQR";  a machine that does both ABC and PQR roles gets both sets.  
(And a machine in neither list would not get any of those packages.)

It is the "policy => ifdefined" that makes all this possible, and it seems to 
work nicely.

But it also reports:
----------
!! Package "cf_null" cannot be updated -- no match or not installed
I: Made in version 'not specified' of '/var/cfengine/inputs/dhs/packages.cf' 
near line 60
----------
where line 60 is the "package_policy" clause.

I've also seen something related under 'package_policy => "add"', when the 
invoked "rpm ..." command reports that it cannot find a "cf_null" RPM.

It seems that the special "cf_null" value is being used internally in 
calculating what to do (which is fine), but that the code is failing to strip 
out that special placeholder "cf_null" prior to invoking the package 
installation commands (which is not so fine).

Are there any known bugs relating to this in 3.1.4?  If so, are they fixed in 
the 3.2.x series?

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

Reply via email to