Forum: Cfengine Help
Subject: Re: package mgmt with apt
Author: joke
Link to topic: https://cfengine.com/forum/read.php?3,18977,18979#msg-18979

There are pitfalls using apt or aptitude with cfengine. You need to make sure 
to disable interactive functions of apt-get/aptitude or the install process 
will get stuck every time cfengine tries to install or update a package using 
apt-get/aptitude.

First of all make sure to disable the invocation of debconf using 
DEBIAN_FRONTENT environment variable. Second make sure to use a locale which is 
ASCII compatible. Use LC_ALL=C or an UTF-8 locale.

body agent control {
        environment => {
                "DEBIAN_FRONTEND=noninteractive",
                "LC_ALL=en_US.utf8"
        };
}

Since debconf is disabled use may need to preconfigure the debconf database. 
This is only necessary if you want to change the default setting and the 
package has been installed yet. Consult the debconf manpage how to do it.


Setup the package management commands for apt-get or aptitude (example).
Make sure to add this commandline option to every apt-get/aptitude command to 
prevent them from asking what to do if there are any changes to configuration 
files. The option is passed down to dpkg (consult the manpage). You can 
customize the package commands as needed. Use cfengine to handle changes to 
configuration files.

Add:   -o Dpkg::Options::=--force-confold

package_add_command => "/usr/bin/aptitude -o Dpkg::Options::=--force-confold 
--assume-yes install";
package_remove_command => "/usr/bin/aptitude -o Dpkg::Options::=--force-confold 
--assume-yes remove";
...................
package_add_command => "/usr/bin/apt-get -o Dpkg::Options::=--force-confold 
--assume-yes install";
...................


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

Reply via email to