Hi,

we need to remove Debian Packages via cfengine. Unfortunately  this  
doesn't work.

We have the following config on standard debian etch:
<---------
control:
  actionsequence = ( packages )

  DPKGInstallCommand = ( "/usr/bin/aptitude -q -y install %s" )
  DPKGRemoveCommand = ( "/usr/bin/aptitude -q -y remove %s" )

  debian::
         DefaultPkgMgr = ( dpkg )
  !debian::
         DefaultPkgMgr = ( rpm )

packages:

   debian::
         vim     action=install
                 define=havevim

         nano    action=remove
                 cmp=ge
                 version=0.1
 >---------

Install works, uninstall doesn't. We examined this problem and it  
seems, the remove command wasn't invoked at all. Further investigation  
and trial and error leeds to the following workarround:

cfengine-2.2.7/src/do.c:
function  CheckPackages():
[...]
/* Handle install/remove logic now. */
    if (match)
       {
       AddMultipleClasses(ptr->defines);

       if (ptr->action == pkgaction_remove)
          {
          PackageList(ptr,name,ptr->pkgmgr,ptr->ver,ptr- 
 >cmp,&pending_pkgs);
        
        /* added to pass the packages, wich should be removed, to the remove  
command */
          AppendItem(&pending_pkgs,name, NULL);
          /* Some package managers operate best doing things one at a  
time. */
          if ((ptr->pkgmgr == pkgmgr_freebsd) || (ptr->pkgmgr ==  
pkgmgr_sun) || (ptr->pkgmgr == pkgmgr_dpkg)) /* added DPKG to invoke  
remove command */
             {
             RemovePackage(ptr,ptr->pkgmgr,&pending_pkgs);
             DeleteItemList(pending_pkgs);
             pending_pkgs = NULL;
             }
          }
       else if (ptr->action == pkgaction_upgrade || (ptr->action ==  
pkgaction_fix))
[...]

I'm no skilled C cfengine developer, therefore it maybe a dirty  
workarround, but we didn't get this to wotk otherwise. Please  
investigate this issue.

Thank you.

Florian
--

noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100

http://www.noris.de - The IT-Outsourcing Company

Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk -
Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689


_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to