Modernize Python 2 code to get ready for Python 3

This commit is contained in:
cclauss
2018-02-08 16:39:06 +01:00
parent e982f6ed06
commit e18838a4b7
16 changed files with 28 additions and 29 deletions

View File

@@ -69,7 +69,7 @@ def parse_configuration():
errors.append("Missing TOWER_INVENTORY in environment")
if errors:
raise RuntimeError("\n".join(errors))
return dict(tower_host=host_name,
tower_user=username,
tower_pass=password,
@@ -103,9 +103,9 @@ def read_tower_inventory(tower_host, tower_user, tower_pass, inventory, license_
return response.json()
json_reason = response.json()
reason = json_reason.get('detail', 'Retrieving Tower Inventory Failed')
except requests.ConnectionError, e:
except requests.ConnectionError as e:
reason = "Connection to remote host failed: {}".format(e)
except json.JSONDecodeError, e:
except json.JSONDecodeError as e:
reason = "Failed to parse json from host: {}".format(e)
raise RuntimeError(reason)