summaryrefslogtreecommitdiffstats
path: root/src/lib/Client/Tools/Yum.py
blob: 8d3b0da6b57ec9db18794af9d0ff32bd20ce80dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# This is the bcfg2 support for yum
'''This provides bcfg2 support for yum'''
__revision__ = '$Revision$'

import Bcfg2.Client.Tools.RPM

conflicts = ['RPM']

class Yum(Bcfg2.Client.Tools.RPM.RPM):
    '''Support for Yum packages'''
    pkgtype = 'yum'
    pkgtool = ("/usr/bin/yum -d0 -y install %s", ("%s-%s", ["name", "version"]))
    __name__ = 'Yum'
    __execs__ = ['/usr/bin/yum', '/var/lib/rpm']
    __handles__ = [('Package', 'yum')]
    __req__ = {'Package': ['name', 'version']}

    def RemovePackages(self, packages):
        '''Remove specified entries'''
        pkgnames = [pkg.get('name') for pkg in packages]
        if len(pkgnames) > 0:
            self.logger.info("Removing packages: %s" % pkgnames)
            if self.cmd.run("yum -d0 -y remove %s" % " ".join(pkgnames))[0] == 0:
                self.modified += packages
            self.RefreshPackages()
            self.extra = self.FindExtraPackages()