This is good feedback. If we know the point at which aptitude came into play, 
then we can
place classes in the body to separate, or test for it, e.g.

body package_method debian
{
have_aptitude::

 ....

!have_aptitude::

 ....

}

Jonathan Clarke wrote:
> Hi,
> 
> I've been testing the standard library, in particular the apt 
> package_method. I come with a bug and some suggestions.
> 
> First off, the bug. package_update_command is set to "apt-get 
> dist-upgrade", which cause *all* packages to be updated to the latest 
> version, not just the one(s) we're updating. This fixes that:
> 
> -package_update_command =>  "/usr/bin/apt-get --yes dist-upgrade";
> +package_update_command =>  "/usr/bin/apt-get --yes install";
> 
> (around line 779 of cfengine_stdlib.cf)
> 
> Yes, the "install" command would also install a package. If you specify 
> package_policy => "update", and the package is not installed, cf3 checks 
> first if the package is installed and won't run the update command if 
> it's not. So no risk here.
> 
> Secondly, this body uses "apt-get" for all commands, while "aptitude" is 
> the preferred package manager on Debian systems. I would like to suggest 
> either:
> 1) Replacing apt-get by aptitude in the apt package_method. However, 
> this may not be optimal on very old Debian installations, and might 
> confuse some people (if any are already relying on the stdlib).
> 2) Add another package_method, named "aptitude", that uses "aptitude" 
> instead of "apt-get".
> 
> The patch is as follows (note the change in the option name):
> 
> -package_add_command => "/usr/bin/apt-get --yes install";
> -package_delete_command => "/usr/bin/apt-get --yes remove";
> -package_update_command =>  "/usr/bin/apt-get --yes dist-upgrade";
> +package_add_command => "/usr/bin/aptitude --assume-yes install";
> +package_delete_command => "/usr/bin/aptitude --assume-yes remove";
> +package_update_command =>  "/usr/bin/aptitude --assume-yes install";
> 
> (around line 777 of cfengine_stdlib.cf)
> 
> Apart from this, it is really great to have a standard library to base 
> our configuration on! It is making all my promise files *a lot* simpler 
> :-) Thanks!
> 
> Regards,
> Jonathan
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@cfengine.org
> https://cfengine.org/mailman/listinfo/help-cfengine

-- 
Mark Burgess

-------------------------------------------------
Professor of Network and System Administration
Oslo University College, Norway

Personal Web: http://www.iu.hio.no/~mark
Office Telf : +47 22453272
-------------------------------------------------
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to