base_name = module_info['base_name']
self.modules[base_name] = module_info
upstream_version = self.get_upstream_version(module_info)
+ self.modules[base_name]['upstream_version'] = upstream_version
if self.verbose > 2:
LOG.debug("Found module information:\n{}".format(pp(self.modules)))
LOG.warn(warn_msg)
LOG.debug("Got status code: {}.".format(response.status_code))
- if response.ok:
- if response.text:
- msg = "Output:\n{}".format(response.text)
+ if not response.ok:
+ LOG.debug("Did not found module {user}-{module} on Puppet forge.".format(
+ user=module_info['vendor'], module=module_info['base_name']))
+ return None
+
+ if not response.text:
+ LOG.warn("No output for URL {!r}".format(url))
+ return None
+ if self.verbose > 2:
+ msg = "Output:\n{}".format(response.text)
+ LOG.debug(msg)
+
+ js_info = response.json()
+ if 'current_release' in js_info:
+ if 'version' in js_info['current_release']:
+ version = js_info['current_release']['version']
else:
- msg = "No output."
- LOG.info(msg)
- #self.print_out(msg)
- return version
+ msg = "Did not found version of current_release of module {user}-{module}.".format(
+ user=module_info['vendor'], module=module_info['base_name'])
+ LOG.warn(msg)
+ else:
+ msg = "Did not found current_release of module {user}-{module}.".format(
+ user=module_info['vendor'], module=module_info['base_name'])
+ LOG.warn(msg)
+
+ LOG.debug("Vurrent version of module {user}-{module} is {version}.".format(
+ user=module_info['vendor'], module=module_info['base_name'], version=version))
return version