Skip to content

Commit

Permalink
Replace removed module._check_required_* calls (ansible-network#161)
Browse files Browse the repository at this point in the history
 Replace removed module._check_required_* calls

Reviewed-by: https://github.com/apps/ansible-zuul
  • Loading branch information
Qalthos authored Mar 25, 2021
1 parent 4129759 commit f21a37a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelogs/fragments/remove-check_required.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
trivial:
- Replace module._check_required_if removed in ansible-core 2.11 with call from common.validation
7 changes: 6 additions & 1 deletion plugins/modules/junos_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@

from copy import deepcopy

from ansible.module_utils._text import to_text
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.common.validation import check_required_if
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import (
remove_default_spec,
)
Expand Down Expand Up @@ -306,7 +308,10 @@ def main():
if param.get(key) is None:
param[key] = module.params[key]

module._check_required_if(required_if, param)
try:
check_required_if(required_if, param)
except TypeError as exc:
module.fail_json(to_text(exc))

item = param.copy()
dest = item.get("dest")
Expand Down
3 changes: 3 additions & 0 deletions tests/sanity/ignore-2.11.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
plugins/action/junos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
plugins/modules/junos_bgp_global.py validate-modules:no-log-needed # temporary workaround for unspecified no-log
plugins/modules/junos_ospf_interfaces.py validate-modules:no-log-needed # temporary workaround for unspecified no-log
plugins/modules/junos_user.py validate-modules:no-log-needed # temporary workaround for unspecified no-log

0 comments on commit f21a37a

Please sign in to comment.