Skip to content

Commit

Permalink
Minor improvements for group scope
Browse files Browse the repository at this point in the history
  • Loading branch information
ezh committed Feb 13, 2020
1 parent d2eb3f9 commit b5ec2a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 6 additions & 8 deletions cloudselect/group/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def run(self, name, metadata):
groups_by_priority = list(self.get_groups_with_priority(self.config()))

for priority, filters, group in sorted(groups_by_priority, key=lambda x: x[0]):
self.logger.debug("Process group {} {}".format(priority, filters))
self.logger.debug("Process group %s %s", priority, filters)
for entry in filters:
if entry == "*":
result = group.get(name)
Expand All @@ -37,23 +37,21 @@ def run(self, name, metadata):
try:
value = value.get(key_part)
if not value:
self.logger.debug(
"Unable to find key {}".format(key_part),
)
self.logger.debug("Unable to find key %s", key_part)
break
except Exception:
self.logger.debug("Unable to find key {}".format(key_part))
self.logger.debug("Unable to find key %s", key_part)
break
if pattern in value:
self.logger.debug(
"Match pattern {} and value {}".format(pattern, value),
"Match pattern %s and value %s", pattern, value,
)
result = group.get(name)
if result is not None:
return result
else:
self.logger.warning(
"Unable to find filter definition for {}".format(group),
"Unable to find filter definition for %s", group,
)
return {}

Expand All @@ -62,7 +60,7 @@ def get_groups_with_priority(self, groups):
for pattern in groups:
group = groups[pattern]
if not isinstance(group, dict):
logging.debug("Skip group with pattern {}".format(pattern))
logging.debug("Skip group with pattern %s", pattern)
continue
filters = pattern.split(" ", 1)
priority = self.default_priority
Expand Down
2 changes: 0 additions & 2 deletions cloudselect/group/stub.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@

class Stub(GroupService):
"""Class implementing group stub plugin."""

pass

0 comments on commit b5ec2a3

Please sign in to comment.