Skip to content

Commit

Permalink
Merge pull request #103 from scsitteam/multi_rule_bugs
Browse files Browse the repository at this point in the history
Problem: Multi rule bugs
  • Loading branch information
ansibleguy authored Oct 25, 2024
2 parents d4fc647 + 0087d7f commit 7adadff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/module_utils/helper/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,6 @@ def unset_check_error(params: dict, field: str, fail: bool) -> bool:
return True

def sanitize_module_args(args: dict) -> dict:
args.pop('api_key')
args.pop('api_secret')
args.pop('api_key', None)
args.pop('api_secret', None)
return args
7 changes: 7 additions & 0 deletions plugins/module_utils/helper/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from ansible_collections.ansibleguy.opnsense.plugins.module_utils.helper.main import \
get_matching
from ansible_collections.ansibleguy.opnsense.plugins.module_utils.defaults.rule import \
RULE_DEFAULTS


def validate_values(error_func, module: AnsibleModule, cnf: dict) -> None:
Expand Down Expand Up @@ -45,6 +47,11 @@ def check_purge_configured(module: AnsibleModule, existing_rule: dict) -> bool:
if rule_config is None:
rule_config = {}

rule_config = {
**RULE_DEFAULTS,
**rule_config,
}

rule_config[module.params['key_field']] = rule_key
configured_rules.append(rule_config)

Expand Down

0 comments on commit 7adadff

Please sign in to comment.