From 2454dddb3a5a0afdcfc2f875edfdcc7b5a85d4ba Mon Sep 17 00:00:00 2001 From: John Morris Date: Sun, 20 Apr 2014 17:06:54 -0500 Subject: Enable bcfg2-yum-helper to depsolve for arches incompatible with server By default, the yum dependency resolver uses the host's architecture to filter compatible packages. This prevents dependency resolution when the bcfg2 client's architecture is incompatible with the server's. This workaround checks the element for each of the client's yum sources, and if they are all identical, passes that architecture to bcfg2-yum-helper to override the default. The rpmUtils.arch module may only be configured for a single architecture. If multiple architectures are configured in yum sources, we don't know which one to pick, so use the default behavior instead. --- src/sbin/bcfg2-yum-helper | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/sbin') diff --git a/src/sbin/bcfg2-yum-helper b/src/sbin/bcfg2-yum-helper index 227d977de..dc6a6cc0b 100755 --- a/src/sbin/bcfg2-yum-helper +++ b/src/sbin/bcfg2-yum-helper @@ -62,6 +62,10 @@ class YumHelper(object): # pylint: enable=E1121,W0212 self.logger = logging.getLogger(self.__class__.__name__) + def setarch(self, arch): + """ Configure an arch other than the bcfg2 server arch for dep + resolution. """ + self.yumbase.arch.setup_arch(arch=arch) class DepSolver(YumHelper): """ Yum dependency solver. This is used for operations that only @@ -326,6 +330,11 @@ def main(): sys.exc_info()[1]) rv = 2 try: + # if provided, set client arch for dependency resolution + arch = data.get('arch', None) + if arch is not None: + depsolver.setarch(arch) + depsolver.groups = data['groups'] (packages, unknown) = depsolver.complete( [pkg_to_tuple(p) for p in data['packages']]) -- cgit v1.2.3-1-g7c22