diff options
author | Toshio Kuratomi <a.badger@gmail.com> | 2018-09-07 17:59:46 -0700 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2018-12-16 15:03:19 -0800 |
commit | 3fba0062078cc04eabb460ec1eb13a4739235199 (patch) | |
tree | 9c09103ce103a90f97ccf3736ca6c2502d7860f8 /lib/ansible/galaxy | |
parent | 5147e792d398258a5a87c3271ea89c1c4fd2f4d3 (diff) | |
download | ansible-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 'lib/ansible/galaxy')
-rw-r--r-- | lib/ansible/galaxy/api.py | 4 | ||||
-rw-r--r-- | lib/ansible/galaxy/login.py | 4 | ||||
-rw-r--r-- | lib/ansible/galaxy/role.py | 10 |
3 files changed, 9 insertions, 9 deletions
diff --git a/lib/ansible/galaxy/api.py b/lib/ansible/galaxy/api.py index e11f3926ab..ead7f26b15 100644 --- a/lib/ansible/galaxy/api.py +++ b/lib/ansible/galaxy/api.py @@ -183,7 +183,7 @@ class GalaxyAPI(object): role_name = parts[-1] if notify: display.display("- downloading role '%s', owned by %s" % (role_name, user_name)) - except: + except Exception: raise AnsibleError("Invalid role name (%s). Specify role as format: username.rolename" % role_name) url = '%s/roles/?owner__username=%s&name=%s' % (self.baseurl, user_name, role_name) @@ -210,7 +210,7 @@ class GalaxyAPI(object): results += data['results'] done = (data.get('next_link', None) is None) return results - except: + except Exception: return None @g_connect diff --git a/lib/ansible/galaxy/login.py b/lib/ansible/galaxy/login.py index e418a5ca60..d8fc97cda3 100644 --- a/lib/ansible/galaxy/login.py +++ b/lib/ansible/galaxy/login.py @@ -60,12 +60,12 @@ class GalaxyLogin(object): try: self.github_username = input("Github Username: ") - except: + except Exception: pass try: self.github_password = getpass.getpass("Password for %s: " % self.github_username) - except: + except Exception: pass if not self.github_username or not self.github_password: diff --git a/lib/ansible/galaxy/role.py b/lib/ansible/galaxy/role.py index e727f112b0..cf5cdb9d2e 100644 --- a/lib/ansible/galaxy/role.py +++ b/lib/ansible/galaxy/role.py @@ -100,7 +100,7 @@ class GalaxyRole(object): try: f = open(meta_path, 'r') self._metadata = yaml.safe_load(f) - except: + except Exception: display.vvvvv("Unable to load metadata for %s" % self.name) return False finally: @@ -120,7 +120,7 @@ class GalaxyRole(object): try: f = open(info_path, 'r') self._install_info = yaml.safe_load(f) - except: + except Exception: display.vvvvv("Unable to load Galaxy install info for %s" % self.name) return False finally: @@ -144,7 +144,7 @@ class GalaxyRole(object): with open(info_path, 'w+') as f: try: self._install_info = yaml.safe_dump(info, f) - except: + except Exception: return False return True @@ -159,7 +159,7 @@ class GalaxyRole(object): try: rmtree(self.path) return True - except: + except Exception: pass return False @@ -285,7 +285,7 @@ class GalaxyRole(object): else: try: self._metadata = yaml.safe_load(role_tar_file.extractfile(meta_file)) - except: + except Exception: raise AnsibleError("this role does not appear to have a valid meta/main.yml file.") # we strip off any higher-level directories for all of the files contained within |