if module_info:
self.forge_modules.append(module_info)
modules_done.append(full_name)
- if not self.verbose:
- if module_info:
- print('.', end='', flush=True)
- else:
- print('~', end='', flush=True)
+# if not self.verbose:
+# if module_info:
+# print('.', end='', flush=True)
+# else:
+# print('~', end='', flush=True)
if self.verbose > 1:
LOG.debug(_(
m=full_name, u=url))
session = requests.Session()
- with warnings.catch_warnings(record=True) as w:
- warnings.simplefilter("always")
- response = session.request('GET', url, timeout=http_timeout)
- if w:
- warn_class = w[-1].category.__name__
- warn_msg = '{}: {}'.format(
- warn_class, w[-1].message)
- if warn_class == 'SubjectAltNameWarning':
- LOG.debug(warn_msg)
- else:
- LOG.warn(warn_msg)
-
- LOG.debug("Got status code: {}.".format(response.status_code))
+ try:
+ with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter("always")
+ response = session.request('GET', url, timeout=http_timeout)
+ if w:
+ warn_class = w[-1].category.__name__
+ warn_msg = '{}: {}'.format(
+ warn_class, w[-1].message)
+ if warn_class == 'SubjectAltNameWarning':
+ LOG.debug(warn_msg)
+ else:
+ LOG.warn(warn_msg)
+ except requests.exceptions.ReadTimeout as e:
+ LOG.error("{c}: {e}".format(c=e.__class__.__name__, e=e))
+ return None
+
+ LOG.debug(_("Got status code: {}.").format(response.status_code))
if not response.ok:
- LOG.debug("Did not found module {} on Puppet forge.".format(full_name))
+ LOG.debug(_("Did not found module {} on Puppet forge.").format(full_name))
return None
if not response.text: