from .module_meta_info import ModuleMetadata
-__version__ = '0.6.3'
+__version__ = '0.6.4'
LOG = logging.getLogger(__name__)
if value is None:
self._superseded_by = None
return
+ if isinstance(value, collections.Mapping):
+ self._superseded_by = copy.copy(value)
+ return
+
v = str(value).strip()
if value == '':
self._superseded_by = None
js_info['owner'], appname=appname, verbose=verbose, base_dir=base_dir)
if module_info.superseded_by:
+ subst = module_info.superseded_by
+ if verbose > 2:
+ LOG.debug("Superseded info:\n" + pp(subst))
+ if 'slug' in subst:
+ subst = subst['slug']
LOG.warning(_(
"Module {c!r} is deprecated at Puppet forge and should be substituted "
- "by module {n!r}.").format(c=module_info.slug, n=module_info.superseded_by))
+ "by module {n!r}.").format(c=module_info.slug, n=subst))
return module_info
if 'slug' not in data:
msg = _("Did not found {!r}-definition in data for forge module:").format(
- 'slug') + '\n' + pp(data))
+ 'slug') + '\n' + pp(data)
LOG.error(msg)
return None
full_name = data['slug'].strip()
if full_name == '':
msg = _("Found empty {!r}-definition in data for forge module:").format(
- 'slug') + '\n' + pp(data))
+ 'slug') + '\n' + pp(data)
LOG.error(msg)
return None
self.http_timeout = self.default_http_timeout
self.modules = None
self._do_forge = True
- self.forge_modules = None
- self.env_modules = None
description = _(
"Collects information about all used Puppet Modules from {url!r} "
LOG.info(msg)
self.print_out(msg)
modules_done = []
+ self.forge_modules = []
- i = 0
for env in self.environments:
for full_name in self.env_modules[env].keys():
if full_name in modules_done:
continue
- self.get_forge_module_info(full_name)
+ module_info = self.get_forge_module_info(full_name)
+ if module_info:
+ self.forge_modules.append(module_info)
modules_done.append(full_name)
- i += 1
- if i >= 3:
- break
if not self.verbose:
if self.modules[full_name].forge_avail:
print('.', end='', flush=True)
appname=self.appname, verbose=self.verbose, base_dir=self.base_dir, )
if module_info:
- if self.verbose > 2:
+ if self.verbose > 3:
LOG.debug(_("Got module info from Forge:") + '\n' + pp(module_info.as_dict()))
+ else:
+ LOG.debug(_("Got module info from Forge for module {!r}.").format(full_name))
else:
- LOG.warn(_("Got no module info for {!r} from Forge.").format(full_name))
-
-# module_info = self.modules[full_name]
-#
-# module_info_forge = ModuleInfo.get_from_forge(
-# full_name, forge_uri=self.forge_uri, http_timeout=self.http_timeout,
-# appname=self.appname, verbose=self.verbose, base_dir=self.base_dir, )
-#
-# if module_info_forge:
-# module_info.merge_in(module_info_forge)
-# else:
-# module_info.set_ts_checked()
-# module_info.forge_avail = False
+ LOG.info(_("Got no module info for {!r} from Forge.").format(full_name))
+
+ return module_info
# -------------------------------------------------------------------------
def read_metadata_files(self, env):