diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2014-12-09 11:10:24 -0600 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2015-02-18 08:24:24 -0600 |
commit | 89e7afbf74ffbbb54dd892bf2c4245aedee2a832 (patch) | |
tree | ed4623b5c6e39d80c132e9f21f3d4804cabd93be /src/lib/Bcfg2/Server/Plugins/AWSTags.py | |
parent | 64b458b380620f84843b1841b441745a0984946f (diff) | |
download | bcfg2-89e7afbf74ffbbb54dd892bf2c4245aedee2a832.tar.gz bcfg2-89e7afbf74ffbbb54dd892bf2c4245aedee2a832.tar.bz2 bcfg2-89e7afbf74ffbbb54dd892bf2c4245aedee2a832.zip |
Remove blanket excepts from plugins and lint
This removes most blanket except: clauses from all plugins, including
the base plugin libraries, and bcfg2-lint. The few that remain should
all be necessary.
Most of the changes were quite minor, but this did require some
restructuring of the CfgPrivateKeyCreator; as a result, the tests for
that module were rewritten.
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/AWSTags.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/AWSTags.py | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/AWSTags.py b/src/lib/Bcfg2/Server/Plugins/AWSTags.py index 3f92542e7..0d6eefaaa 100644 --- a/src/lib/Bcfg2/Server/Plugins/AWSTags.py +++ b/src/lib/Bcfg2/Server/Plugins/AWSTags.py @@ -1,4 +1,4 @@ -""" Query tags from AWS via boto, optionally setting group membership """ +"""Query tags from AWS via boto, optionally setting group membership.""" import os import re @@ -82,22 +82,17 @@ class PatternFile(Bcfg2.Server.Plugin.XMLFileBacked): self.tags.append(AWSTagPattern(entry.get("name"), entry.get("value"), groups)) - except: # pylint: disable=W0702 + except re.error: self.logger.error("AWSTags: Failed to initialize pattern %s: " "%s" % (entry.get("name"), sys.exc_info()[1])) - def get_groups(self, hostname, tags): + def get_groups(self, tags): """ return a list of groups that should be added to the given - client based on patterns that match the hostname """ + client based on patterns that match the tags """ ret = [] for pattern in self.tags: - try: - ret.extend(pattern.get_groups(tags)) - except: # pylint: disable=W0702 - self.logger.error("AWSTags: Failed to process pattern %s for " - "%s" % (pattern, hostname), - exc_info=1) + ret.extend(pattern.get_groups(tags)) return ret @@ -182,5 +177,4 @@ class AWSTags(Bcfg2.Server.Plugin.Plugin, return self.get_tags(metadata) def get_additional_groups(self, metadata): - return self.config.get_groups(metadata.hostname, - self.get_tags(metadata)) + return self.config.get_groups(self.get_tags(metadata)) |