mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-22 18:31:25 -07:00
[PR #9893/9286b601 backport][stable-10] cmd_runner_fmt.as_fixed() now accepts list of args (#9915)
cmd_runner_fmt.as_fixed() now accepts list of args (#9893)
* cmd_runner_fmt.as_fixed() now accepts list of args
* update CmdRunner guide
* add changelog frag
* Update changelogs/fragments/9893-cmdrunner-as-fixed-args.yml
* fix overdoing in as_fixed()
(cherry picked from commit 9286b60182
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
3955a6be0f
commit
f0f5035ba2
3 changed files with 48 additions and 14 deletions
|
@ -78,7 +78,9 @@ def as_list(ignore_none=None, min_len=0, max_len=None):
|
|||
return _ArgFormat(func, ignore_none=ignore_none)
|
||||
|
||||
|
||||
def as_fixed(args):
|
||||
def as_fixed(*args):
|
||||
if len(args) == 1 and is_sequence(args[0]):
|
||||
args = args[0]
|
||||
return _ArgFormat(lambda value: _ensure_list(args), ignore_none=False, ignore_missing_value=True)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue