Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-3504

Use package modules without having def.cf

    XMLWordPrintable

    Details

      Description

      It would be nice if I could write a policy that inclused just packages.cf from the standard library and be able to use package modules explicitly.

      Currently doing so results in errors because the package promise fails sanity check for query_installed_ifelapsed and query_updates_ifelapsed. (they are both currently sourced from def).

      Example:

      body file control
      {
            inputs => { "$(sys.libdir)/stdlib.cf" };
      }
      
      bundle agent manage_ntp
      {
         vars:
             "ntp_package_name" string => "ntp";
      
         packages:
           centos|redhat::
             "$(ntp_package_name)"   -> { "StandardsDoc 3.2.1" }
             policy                  => "present",
             package_module          => yum,
             handle                  => "manage_ntp_packages_$(ntp_package_name)_rpm",
             classes                 => if_ok("ntp_installed");
      
           debian|ubuntu::
             "$(ntp_package_name)"   -> { "StandardsDoc 3.2.1" }
             policy                  => "present",
            package_module          => apt_get,
            handle                  => "manage_ntp_packages_$(ntp_package_name)_deb",
            classes                 => if_ok("ntp_installed");
      }
      bundle agent __main__
      {
        methods:
          "manage_ntp";
      }
      
      
      [root@hub ~]# cf-agent -KIf /tmp/ensure_ntp.cf 
         error: Invalid or missing arguments in package_module body 'yum':  query_installed_ifelapsed = -678 query_updates_ife
         error: New package promise failed sanity check.
         error: Invalid or missing arguments in package_module body 'yum':  query_installed_ifelapsed = -678 query_updates_ife
         error: New package promise failed sanity check.
         error: Invalid or missing arguments in package_module body 'yum':  query_installed_ifelapsed = -678 query_updates_ife
         error: New package promise failed sanity check.
         error: Method 'manage_ntp' failed in some repairs
      

        Attachments

          Activity

            People

            • Assignee:
              a10042 Nick Anderson
              Reporter:
              a10042 Nick Anderson
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel