Skip to content

Commit

Permalink
Merge branch 'main' into bugfix_ip4_hex
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwini-mhatre authored Jul 19, 2023
2 parents e4ee411 + 1c31436 commit bec9760
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/asottile/add-trailing-comma
rev: v2.5.1
rev: v3.0.0
hooks:
- id: add-trailing-comma

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0-alpha.9-for-vscode"
rev: "v3.0.0"
hooks:
- id: prettier
additional_dependencies:
Expand All @@ -36,6 +36,6 @@ repos:
args: ["--filter-files"]

- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.7.0
hooks:
- id: black
6 changes: 3 additions & 3 deletions plugins/action/cli_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def _load_parser(self, task_vars):
self._display.warning(msg)

parserlib = "ansible_collections.{corg}.{cname}.plugins.sub_plugins.cli_parser.{plugin}_parser".format(
**cref
**cref,
)
try:
parsercls = getattr(import_module(parserlib), self.PARSER_CLS_NAME)
Expand All @@ -135,7 +135,7 @@ def _load_parser(self, task_vars):
]:
parserlib = (
"ansible_collections.{corg}.{cname}.plugins.cli_parsers.{plugin}_parser".format(
**cref
**cref,
)
)
try:
Expand Down Expand Up @@ -281,7 +281,7 @@ def run(self, tmp=None, task_vars=None):
DOCUMENTATION,
"cli_parse module",
schema_conditionals=ARGSPEC_CONDITIONALS,
**self._task.args
**self._task.args,
)
if not valid:
return argspec_result
Expand Down
2 changes: 1 addition & 1 deletion plugins/action/fact_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _load_plugin(self, plugin, directory, class_name):
cref.update(directory=directory)
parserlib = (
"ansible_collections.{corg}.{cname}.plugins.sub_plugins.{directory}.{plugin}".format(
**cref
**cref,
)
)
try:
Expand Down
2 changes: 1 addition & 1 deletion plugins/action/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def run(self, tmp=None, task_vars=None):
DOCUMENTATION,
"validate module",
schema_conditionals=ARGSPEC_CONDITIONALS,
**self._task.args
**self._task.args,
)
if not valid:
return argspec_result
Expand Down
5 changes: 4 additions & 1 deletion plugins/filter/param_list_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@ def param_list_compare(*args, **kwargs):
)

valid, argspec_result, updated_params = check_argspec(
DOCUMENTATION, "param_list_compare filter", schema_conditionals=ARGSPEC_CONDITIONALS, **data
DOCUMENTATION,
"param_list_compare filter",
schema_conditionals=ARGSPEC_CONDITIONALS,
**data,
)
if not valid:
raise AnsibleFilterError(
Expand Down
5 changes: 4 additions & 1 deletion plugins/filter/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ def validate(*args, **kwargs):
params.update({"engine": kwargs["engine"]})

valid, argspec_result, updated_params = check_argspec(
DOCUMENTATION, "validate filter", schema_conditionals=ARGSPEC_CONDITIONALS, **params
DOCUMENTATION,
"validate filter",
schema_conditionals=ARGSPEC_CONDITIONALS,
**params,
)
if not valid:
raise AnsibleFilterError(
Expand Down
2 changes: 1 addition & 1 deletion plugins/lookup/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def run(self, terms, variables, **kwargs):
schema=schema[0],
name="validate lookup",
schema_conditionals=ARGSPEC_CONDITIONALS,
**params
**params,
)
if not valid:
raise AnsibleLookupError(
Expand Down
6 changes: 4 additions & 2 deletions plugins/plugin_utils/base/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, data, criteria, engine, plugin_vars=None, kwargs=None):
cref = dict(zip(["corg", "cname", "plugin"], engine.split(".")))
validatorlib = (
"ansible_collections.{corg}.{cname}.plugins.sub_plugins.validate.{plugin}".format(
**cref
**cref,
)
)

Expand Down Expand Up @@ -123,7 +123,9 @@ def _set_sub_plugin_options(self, doc):
break

valid, argspec_result, updated_params = check_argspec(
yaml.dump(argspec_obj), self._engine, **params
yaml.dump(argspec_obj),
self._engine,
**params,
)
if not valid:
raise AnsibleError(
Expand Down
5 changes: 4 additions & 1 deletion plugins/test/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ def validate(*args, **kwargs):
params.update({item: kwargs[item]})

valid, argspec_result, updated_params = check_argspec(
DOCUMENTATION, "validate test", schema_conditionals=ARGSPEC_CONDITIONALS, **params
DOCUMENTATION,
"validate test",
schema_conditionals=ARGSPEC_CONDITIONALS,
**params,
)
if not valid:
raise AnsibleError(
Expand Down
15 changes: 12 additions & 3 deletions tests/unit/plugins/action/test_cli_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ def test_fn_check_argspec_pass(self):
},
}
valid, result, updated_params = check_argspec(
DOCUMENTATION, "cli_parse module", schema_conditionals={}, **kwargs
DOCUMENTATION,
"cli_parse module",
schema_conditionals={},
**kwargs,
)
self.assertEqual(valid, True)

Expand All @@ -94,7 +97,10 @@ def test_fn_check_argspec_fail_no_test_or_command(self):
},
}
valid, result, updated_params = check_argspec(
DOCUMENTATION, "cli_parse module", schema_conditionals=ARGSPEC_CONDITIONALS, **kwargs
DOCUMENTATION,
"cli_parse module",
schema_conditionals=ARGSPEC_CONDITIONALS,
**kwargs,
)

self.assertIn("one of the following is required: command, text", result["errors"])
Expand All @@ -103,7 +109,10 @@ def test_fn_check_argspec_fail_no_parser_name(self):
"""Confirm failed argspec no parser name"""
kwargs = {"text": "anything", "parser": {"command": "show version"}}
valid, result, updated_params = check_argspec(
DOCUMENTATION, "cli_parse module", schema_conditionals=ARGSPEC_CONDITIONALS, **kwargs
DOCUMENTATION,
"cli_parse module",
schema_conditionals=ARGSPEC_CONDITIONALS,
**kwargs,
)
self.assertIn(
"missing required arguments: name found in parser",
Expand Down

0 comments on commit bec9760

Please sign in to comment.