summaryrefslogtreecommitdiff
path: root/contrib/inventory/collins.py
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2018-09-07 17:59:46 -0700
committerToshio Kuratomi <a.badger@gmail.com>2018-12-16 15:03:19 -0800
commit3fba0062078cc04eabb460ec1eb13a4739235199 (patch)
tree9c09103ce103a90f97ccf3736ca6c2502d7860f8 /contrib/inventory/collins.py
parent5147e792d398258a5a87c3271ea89c1c4fd2f4d3 (diff)
downloadansible-3fba0062078cc04eabb460ec1eb13a4739235199.tar.gz
Update bare exceptions to specify Exception.
This will keep us from accidentally catching program-exiting exceptions like KeyboardInterupt and SystemExit.
Diffstat (limited to 'contrib/inventory/collins.py')
-rwxr-xr-xcontrib/inventory/collins.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/contrib/inventory/collins.py b/contrib/inventory/collins.py
index 8c7b36c9bc..b768f6b3f9 100755
--- a/contrib/inventory/collins.py
+++ b/contrib/inventory/collins.py
@@ -208,7 +208,7 @@ class CollinsInventory(object):
break
cur_page += 1
num_retries = 0
- except:
+ except Exception:
self.log.error("Error while communicating with Collins, retrying:\n%s", traceback.format_exc())
num_retries += 1
return assets
@@ -277,7 +277,7 @@ class CollinsInventory(object):
# Locates all server assets from Collins.
try:
server_assets = self.find_assets()
- except:
+ except Exception:
self.log.error("Error while locating assets from Collins:\n%s", traceback.format_exc())
return False
@@ -288,7 +288,7 @@ class CollinsInventory(object):
ip_index = self._asset_get_attribute(asset, 'ANSIBLE_IP_INDEX')
try:
ip_index = int(ip_index)
- except:
+ except Exception:
self.log.error(
"ANSIBLE_IP_INDEX attribute on asset %s not an integer: %s", asset,
ip_index)
@@ -350,7 +350,7 @@ class CollinsInventory(object):
try:
self.write_to_cache(self.cache, self.cache_path_cache)
self.write_to_cache(self.inventory, self.cache_path_inventory)
- except:
+ except Exception:
self.log.error("Error while writing to cache:\n%s", traceback.format_exc())
return False
return True
@@ -388,7 +388,7 @@ class CollinsInventory(object):
json_inventory = cache.read()
self.inventory = json.loads(json_inventory)
return True
- except:
+ except Exception:
self.log.error("Error while loading inventory:\n%s",
traceback.format_exc())
self.inventory = {}
@@ -402,7 +402,7 @@ class CollinsInventory(object):
json_cache = cache.read()
self.cache = json.loads(json_cache)
return True
- except:
+ except Exception:
self.log.error("Error while loading host cache:\n%s",
traceback.format_exc())
self.cache = {}