Skip to content

Commit

Permalink
ensure names filter is None if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
dasfmi committed Jul 23, 2024
1 parent 493227e commit 62606b7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ flake8 = "*"
mypy = "*"

[requires]
python_version = "3.8"
python_version = "3.9"
11 changes: 6 additions & 5 deletions subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ def build_groups_list(
pattern: Optional[str] = None,
prefix: Optional[str] = None,
):
# filter out the log groups based on the names, pattern, and prefix provided in the environment variables
groups = []
# ensure filter params have correct values
if pattern == "":
if not names:
names = None
if not pattern:
pattern = None
elif prefix == "":
if not prefix:
prefix = None

# filter out the log groups based on the names, pattern, and prefix provided in the environment variables
groups = []
for g in all_groups:
group = {"name": g["logGroupName"].strip(), "arn": g["arn"]}
if names is None and pattern is None and prefix is None:
Expand Down
6 changes: 4 additions & 2 deletions unsubscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ def build_groups_list(
prefix: Optional[str] = None,
):
# ensure filter params have correct values
if pattern == "":
if not names:
names = None
if not pattern:
pattern = None
elif prefix == "":
if not prefix:
prefix = None
# filter out the log groups based on the names, pattern, and prefix provided in the environment variables
groups = []
Expand Down

0 comments on commit 62606b7

Please sign in to comment.