From 7d6032e82ea26baf82c64435925d6991d812e768 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 14 Jan 2015 23:35:22 +0100 Subject: Plugins/Packages: fix initialization of YumSource During __init__ of the parent class get_repo_name is called. That needs fields (pump_id) that are defined later in the __init__ of YumSource. We introduce the new function _init_attributes to parse all attributes out of the tag before calling any other functions. --- src/lib/Bcfg2/Server/Plugins/Packages/Yum.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/lib/Bcfg2/Server/Plugins/Packages/Yum.py') diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py index 6139a28b5..ae8ac5d6f 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py @@ -1028,8 +1028,9 @@ class YumSource(Source): #: YumSource sets the ``type`` on Package entries to "yum" ptype = 'yum' - def __init__(self, basepath, xsource, setup): - Source.__init__(self, basepath, xsource, setup) + def _init_attributes(self, basepath, xsource, setup): + Source._init_attributes(self, basepath, xsource, setup) + self.pulp_id = None if HAS_PULP and xsource.get("pulp_id"): self.pulp_id = xsource.get("pulp_id") @@ -1071,7 +1072,7 @@ class YumSource(Source): self.needed_paths = set() self.file_to_arch = dict() self.yumgroups = dict() - __init__.__doc__ = Source.__init__.__doc__ + _init_attributes.__doc__ = Source._init_attributes.__doc__ @property def use_yum(self): -- cgit v1.2.3-1-g7c22