summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2014-04-21 12:52:40 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2014-04-21 12:52:40 -0400
commitafc80cef3a253656723958f5736153025d4535c1 (patch)
treeb6991acdcdf20b381d553fcada77c914fcbbf895 /src/lib/Bcfg2
parentd2ca484d6bd07c3d7b36a9da8b59f4c1c523445d (diff)
parent2454dddb3a5a0afdcfc2f875edfdcc7b5a85d4ba (diff)
downloadbcfg2-afc80cef3a253656723958f5736153025d4535c1.tar.gz
bcfg2-afc80cef3a253656723958f5736153025d4535c1.tar.bz2
bcfg2-afc80cef3a253656723958f5736153025d4535c1.zip
Merge pull request #164 from zultron/maint
Enable bcfg2-yum-helper to depsolve for arches incompatible with server
Diffstat (limited to 'src/lib/Bcfg2')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/Yum.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
index 67ff05ca1..6139a28b5 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
@@ -429,6 +429,25 @@ class YumCollection(Collection):
yumconf.write(open(self.cfgfile, 'w'))
+ def get_arch(self):
+ """ If 'arch' for each source is the same, return that arch, otherwise
+ None.
+
+ This helps bcfg2-yum-helper when the client arch is
+ incompatible with the bcfg2 server's arch.
+
+ In case multiple arches are found, punt back to the default behavior.
+ """
+ arches = set()
+ for source in self:
+ for url_map in source.url_map:
+ if url_map['arch'] in self.metadata.groups:
+ arches.add(url_map['arch'])
+ if len(arches) == 1:
+ return arches.pop()
+ else:
+ return None
+
def get_config(self, raw=False): # pylint: disable=W0221
""" Get the yum configuration for this collection.
@@ -886,10 +905,12 @@ class YumCollection(Collection):
if packagelist:
try:
- result = self.call_helper(
- "complete",
- dict(packages=list(packagelist),
- groups=list(self.get_relevant_groups())))
+ helper_dict = dict(packages=list(packagelist),
+ groups=list(self.get_relevant_groups()))
+ arch = self.get_arch()
+ if arch is not None:
+ helper_dict['arch'] = arch
+ result = self.call_helper("complete", helper_dict)
except ValueError:
# error reported by call_helper()
return set(), packagelist