Skip to content

Commit

Permalink
Minor bugfix when searching for nonexistent rule group
Browse files Browse the repository at this point in the history
  • Loading branch information
tremble committed Apr 8, 2022
1 parent adea44d commit a73f78a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/modules/networkfirewall_rule_group_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,10 @@ def main():

if name or arn:
rule = manager.get_rule_group(name=name, rule_type=rule_type, arn=arn)
rules = [rule]
results['rule_groups'] = rules
if rule:
results['rule_groups'] = [rule]
else:
results['rule_groups'] = []
else:
rule_list = manager.list(scope=scope)
results['rule_list'] = rule_list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@
- '"rule_groups" in account_rules_info'
# We've not created anything yet, so there's no guarantee anything will be here

- name: 'Fetch non existent rule groups'
networkfirewall_rule_group_info:
name: '{{ minimal_group_name }}-Missing'
rule_type: 'stateful'
register: account_rules_info

- assert:
that:
- '"rule_groups" in account_rules_info'
- account_rules_info.rule_groups | length == 0

###################################################################
# Creation

Expand Down

0 comments on commit a73f78a

Please sign in to comment.