Skip to content

Commit

Permalink
Fix log msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
bsquizz committed Oct 27, 2021
1 parent aa6f3e7 commit 983cd2f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions bonfire/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ def _compare_version(pypi_version):

if my_version < pypi_version:
log.info(
"\n"
"there is a new bonfire version available! (yours: {}, available: {})"
"\n"
"upgrade with:\n"
Expand Down Expand Up @@ -479,23 +478,23 @@ def check_pypi():
if not _ver_check_needed():
return

log.info("\nChecking pypi for latest release...")
log.info("checking pypi for latest release...")

pkg_data = {}
try:
response = requests.get(PYPI_URL, timeout=5)
response.raise_for_status()
pkg_data = response.json()
except requests.exceptions.Timeout:
log.error("Unable to reach pypi quickly, giving up.")
log.error("unable to reach pypi quickly, giving up.")
except requests.exceptions.HTTPError as e:
log.error("Error response from pypi: ", e.errno, e.message)
log.error("error response from pypi: ", e.errno, e.message)
except ValueError:
log.error("Response was not valid json, giving up.")
log.error("response was not valid json, giving up.")

try:
pypi_version = pkg_data["info"]["version"]
except KeyError:
log.error("Unable to parse version info from pypi")
log.error("unable to parse version info from pypi")
else:
_compare_version(pypi_version)

0 comments on commit 983cd2f

Please sign in to comment.