From 780f03b01a48daccceb287de61f2ff89e6c5056c Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Fri, 30 Apr 2010 19:48:40 +0000 Subject: YUMng: Add support for Path type='ignore' entries Signed-off-by: Sol Jerome git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5851 ce84e21b-d406-0410-9b95-82705330c041 --- doc/client/tools/yumng.txt | 25 ++++++++++++++++++------- doc/server/configurationentries.txt | 9 +++++++++ src/lib/Client/Tools/RPMng.py | 19 ++++++++++++++++++- src/lib/Client/Tools/YUMng.py | 4 +++- 4 files changed, 48 insertions(+), 9 deletions(-) diff --git a/doc/client/tools/yumng.txt b/doc/client/tools/yumng.txt index c3b645a4f..ce1b0a0ad 100644 --- a/doc/client/tools/yumng.txt +++ b/doc/client/tools/yumng.txt @@ -550,19 +550,16 @@ Ignore Tag ^^^^^^^^^^ The Ignore tag is used to "mask out" individual files from the RPM -verification. This is done by comparing the verification failure results -with the Ignore tag name. If there is a match, that entry is not used +verification. This is done by comparing the verification failure results +with the Ignore tag name. If there is a match, that entry is not used by the client to determine if a package has failed verification. Ignore tag entries can be specified at both the Package level, in which case they apply to all Instances, and/or at the Instance level, in which case they only apply to that instance. -Ignore tag entries only work with the RPMng driver. They do not appear -to be supported in YUMng as of 1.0pre5. - -Ignore tag entries can be specified in both old and new style Pkgmgr -files. +Ignore tag entries are used by the RPMng driver. They can be specified +in both old and new style Pkgmgr files. The Ignore Tag supports the following attributes: @@ -581,6 +578,20 @@ Example +POSIX 'ignore' Path entries +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The YUMng analog to the Ignore Tag used by RPMng is the use of Path +entries of type 'ignore'. The following shows an example for the +centos-release package which doesn't verify if you remove the default +repos and replace them with a custom repo. + +.. code-block:: xml + + + + + Automated Generation of Pkgmgr Configuration Files -------------------------------------------------- diff --git a/doc/server/configurationentries.txt b/doc/server/configurationentries.txt index dc445b1b4..af1140bab 100644 --- a/doc/server/configurationentries.txt +++ b/doc/server/configurationentries.txt @@ -68,6 +68,15 @@ the *type* and any other necessary attributes in `Rules`_. | hardlink | New | Create | name, to | | | | hardlinks | | +-------------+----------------------+-----------------+--------------------------+ +| ignore | New | Ignore files | name, to | +| | | that cause | | +| | | package | | +| | | verification | | +| | | failures | | +| | | (currently | | +| | | applies to only | | +| | | YUMng) | | ++-------------+----------------------+-----------------+--------------------------+ | nonexistent | New | Specify a path | name | | | | that should not | | | | | exist | | diff --git a/src/lib/Client/Tools/RPMng.py b/src/lib/Client/Tools/RPMng.py index b8f09ed3e..06792ef13 100644 --- a/src/lib/Client/Tools/RPMng.py +++ b/src/lib/Client/Tools/RPMng.py @@ -42,6 +42,10 @@ class RPMng(Bcfg2.Client.Tools.PkgTool): def __init__(self, logger, setup, config): Bcfg2.Client.Tools.PkgTool.__init__(self, logger, setup, config) + # create a global ignore list used when ignoring particular + # files during package verification + self.ignores = [entry.get('name') for struct in config for entry in struct \ + if entry.get('type') == 'ignore'] self.instance_status = {} self.extra_instances = [] self.modlists = {} @@ -364,7 +368,9 @@ class RPMng(Bcfg2.Client.Tools.PkgTool): # Check the rpm verify file results against the modlist # and entry and per Instance Ignores. - ignores = [ig.get('name') for ig in entry.findall('Ignore')] + [ig.get('name') for ig in inst.findall('Ignore')] + ignores = [ig.get('name') for ig in entry.findall('Ignore')] + \ + [ig.get('name') for ig in inst.findall('Ignore')] + \ + self.ignores for file_result in result.get('files', []): if file_result[-1] not in modlist + ignores: instance_fail = True @@ -830,6 +836,10 @@ class RPMng(Bcfg2.Client.Tools.PkgTool): self.logger.error("Incomplete information for entry %s:%s; cannot verify" \ % (entry.tag, entry.get('name'))) return False + elif entry.tag == 'Path' and entry.get('type') == 'ignore': + # ignored Paths are only relevant during failed package + # verification + pass else: if [attr for attr in self.__req__[entry.tag] if attr not in entry.attrib]: self.logger.error("Incomplete information for entry %s:%s; cannot verify" \ @@ -1008,3 +1018,10 @@ class RPMng(Bcfg2.Client.Tools.PkgTool): init_ts.closeDB() del init_ts return keyids + + def VerifyPath(self, entry, _): + """ + We don't do anything here since all + Paths are processed in __init__ + """ + return True diff --git a/src/lib/Client/Tools/YUMng.py b/src/lib/Client/Tools/YUMng.py index 494c9f896..9faeb3328 100644 --- a/src/lib/Client/Tools/YUMng.py +++ b/src/lib/Client/Tools/YUMng.py @@ -51,7 +51,9 @@ class YUMng(Bcfg2.Client.Tools.RPMng.RPMng): name = 'YUMng' __execs__ = ['/usr/bin/yum', '/var/lib/rpm'] - __handles__ = [('Package', 'yum'), ('Package', 'rpm')] + __handles__ = [('Package', 'yum'), + ('Package', 'rpm'), + ('Path', 'ignore')] __req__ = {'Package': ['name', 'version']} __ireq__ = {'Package': ['name']} -- cgit v1.2.3-1-g7c22