Hi Michael

On Wed, Jan 04, 2012 at 02:51:48PM +0000, Michael Gliwinski said:

> bundle common g {
>   classes:
>     "have_aptitude" not => "have_aptitude";
> }

While I don't know if it's possible to negate an existing class, if what 
you're trying to do is force cfengine to unconditionally use apt-get 
rather than aptitude, then you could copy the "body package_method apt" 
promise from the stdlib, and change it to

body package_method myapt
{
package_changes => "bulk";
package_list_command => "/usr/bin/dpkg -l";
package_list_name_regex    => "ii\s+([^\s]+).*";
package_list_version_regex => "ii\s+[^\s]+\s+([^\s]+).*";
package_installed_regex => ".*"; # all reported are installed
package_name_convention => "$(name)";
package_list_update_ifelapsed => "240";         # 4 hours

# !have_aptitude::
   package_add_command => "/usr/bin/apt-get --yes install";
   package_list_update_command => "/usr/bin/apt-get update";
   package_delete_command => "/usr/bin/apt-get --yes remove";
   package_update_command =>  "/usr/bin/apt-get --yes install";
   package_verify_command => "/usr/bin/dpkg -s";
   package_noverify_returncode => "1";
}

then change your package_method in youdr package installations with 
something like:

packages:
      
  "rsyslog"
      package_policy => "add",
      package_method => myapt,
      classes        => if_repaired ( "rsyslog_installed" );

Cheers
Simon

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

Reply via email to