]> Frank Brehm's Git Trees - pixelpark/puppet-tools.git/commitdiff
Fixing class PuppetfileModuleInfo
authorFrank Brehm <frank.brehm@pixelpark.com>
Wed, 8 Feb 2023 10:58:07 +0000 (11:58 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Wed, 8 Feb 2023 10:58:07 +0000 (11:58 +0100)
lib/dpx_puppettools/pfile_moduleinfo.py

index 95d9c821e4f903b3cbd194c556227f83737ac0b6..644ef963803df69a784575bf6ffccff79ba58da0 100644 (file)
@@ -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']