From: Frank Brehm Date: Wed, 8 Feb 2023 10:58:07 +0000 (+0100) Subject: Fixing class PuppetfileModuleInfo X-Git-Tag: 0.3.0~2^2~62 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=d759b3dbb0a16e555d7d1d13d4c7fbf5269d9fcd;p=pixelpark%2Fpuppet-tools.git Fixing class PuppetfileModuleInfo --- diff --git a/lib/dpx_puppettools/pfile_moduleinfo.py b/lib/dpx_puppettools/pfile_moduleinfo.py index 95d9c82..644ef96 100644 --- a/lib/dpx_puppettools/pfile_moduleinfo.py +++ b/lib/dpx_puppettools/pfile_moduleinfo.py @@ -26,10 +26,11 @@ from fb_tools.common import pp, to_str, to_bool, is_sequence from .xlate import XLATOR -from .base_moduleinfo import BaseModuleInfoError, BaseModuleInfo +from .errors import BaseModuleInfoError +from .base_moduleinfo import BaseModuleInfo -__version__ = '0.2.0' +__version__ = '0.2.1' LOG = logging.getLogger(__name__) @@ -83,7 +84,7 @@ class PuppetfileModuleInfo(BaseModuleInfo): self._exclude_spec = False self._install_path = None - super(ModuleInfo, self).__init__( + super(PuppetfileModuleInfo, self).__init__( appname=appname, verbose=verbose, version=version, base_dir=base_dir, initialized=False, name=name, vendor=vendor, full_name=full_name ) @@ -138,7 +139,7 @@ class PuppetfileModuleInfo(BaseModuleInfo): return self._ref @ref.setter - def def ref(self, value): + def ref(self, value): if value is None: self._ref = None return @@ -217,7 +218,7 @@ class PuppetfileModuleInfo(BaseModuleInfo): @rtype: dict """ - res = super(ModuleInfo, self).as_dict(short=short) + res = super(PuppetfileModuleInfo, self).as_dict(short=short) res['default_branch'] = self.default_branch res['exclude_spec'] = self.exclude_spec @@ -234,7 +235,7 @@ class PuppetfileModuleInfo(BaseModuleInfo): def to_data(self): """Returning a dict, which can be used to re-instantiate this module info.""" - res = super(ModuleInfo, self).to_data() + res = super(PuppetfileModuleInfo, self).to_data() res['default_branch'] = self.default_branch res['exclude_spec'] = self.exclude_spec @@ -419,7 +420,15 @@ class PuppetfileModuleInfo(BaseModuleInfo): module_info.repo_type = 'svn' if 'local' in definitions: - if definitions['local'] + val_local = definitions['local'] + if to_bool(val_local): + module_info.repo_type = 'local' + else: + msg = _( + "PuppetfileModuleInfo for {m!r} has tag :local, but this not set to {t!r}," + " but {v!r} instead.").format( + m=module_info.full_name, t='true', v=val_local) + LOG.warn(msg) if 'source' in definitions: module_info.repo = definitions['source'] @@ -438,7 +447,7 @@ class PuppetfileModuleInfo(BaseModuleInfo): module_info.ref = branch if 'commit' in definitions: - module_info.ref = definitions['commit'} + module_info.ref = definitions['commit'] if 'version' in definitions: module_info.ref = definitions['version']