From d3aa0c11d66ec50ce18bada80bbf2e6beba32a93 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Wed, 17 Aug 2011 09:17:07 -0500 Subject: APT: Add type='ignore' support (patch from tie on IRC) Signed-off-by: Sol Jerome --- doc/server/configurationentries.txt | 2 +- src/lib/Client/Tools/APT.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/server/configurationentries.txt b/doc/server/configurationentries.txt index 35200da37..fbce092b9 100644 --- a/doc/server/configurationentries.txt +++ b/doc/server/configurationentries.txt @@ -101,7 +101,7 @@ Path type specified. | | | failures | | | | | (currently | | | | | applies to only | | -| | | YUMng) | | +| | | APT and YUMng) | | +-------------+----------------------+-----------------+--------------------------+ | nonexistent | New | Specify a path | name, recursive | | | | that should not | | diff --git a/src/lib/Client/Tools/APT.py b/src/lib/Client/Tools/APT.py index 2b8cc3304..b2b8120ba 100644 --- a/src/lib/Client/Tools/APT.py +++ b/src/lib/Client/Tools/APT.py @@ -37,8 +37,8 @@ class APT(Bcfg2.Client.Tools.Tool): """ name = 'APT' __execs__ = [DEBSUMS, APTGET, DPKG] - __handles__ = [('Package', 'deb')] - __req__ = {'Package': ['name', 'version']} + __handles__ = [('Package', 'deb'), ('Path', 'ignore')] + __req__ = {'Package': ['name', 'version'], 'Path': ['type']} def __init__(self, logger, setup, config): Bcfg2.Client.Tools.Tool.__init__(self, logger, setup, config) @@ -55,6 +55,10 @@ class APT(Bcfg2.Client.Tools.Tool): if not self.setup['debug']: self.pkgcmd += '-q=2 ' self.pkgcmd += '-y install %s' + self.ignores = [entry.get('name') for struct in config \ + for entry in struct \ + if entry.tag == 'Path' and \ + entry.get('type') == 'ignore'] self.__important__ = self.__important__ + \ ["%s/cache/debconf/config.dat" % var_path, "%s/cache/debconf/templates.dat" % var_path, @@ -117,6 +121,7 @@ class APT(Bcfg2.Client.Tools.Tool): self.logger.error("Got Unsupported pattern %s from debsums" \ % item) files.append(item) + files = list(set(files) - set(self.ignores)) # We check if there is file in the checksum to do if files: # if files are found there we try to be sure our modlist is sane @@ -231,3 +236,7 @@ class APT(Bcfg2.Client.Tools.Tool): states[package] = self.VerifyPackage(package, [], checksums=False) if states[package]: self.modified.append(package) + + def VerifyPath(self, entry, _): + """Do nothing here since we only verify Path type=ignore""" + return True -- cgit v1.2.3-1-g7c22