1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Prepare main for 7.0.0 (#6428)

* Bump version to 7.0.0.

* Remove deprecated parameters and change some defaults for 7.0.0.

* Remove deprecated alias.

* Adjust tests.
This commit is contained in:
Felix Fontein 2023-04-26 07:32:00 +02:00 committed by GitHub
parent f0fcc91ac7
commit 0a26b6d48d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 72 additions and 123 deletions

View file

@ -0,0 +1,8 @@
breaking_changes:
- "gitlab_runner - the default of ``access_level_on_creation`` changed from ``false`` to ``true`` (https://github.com/ansible-collections/community.general/pull/6428)."
- "nmcli - the default of the ``hairpin`` option changed from ``true`` to ``false`` (https://github.com/ansible-collections/community.general/pull/6428)."
- "proxmox - the default of the ``unprivileged`` option changed from ``false`` to ``true`` (https://github.com/ansible-collections/community.general/pull/6428)."
removed_features:
- "newrelic_deployment - the ``appname`` and ``environment`` options have been removed. They did not do anything (https://github.com/ansible-collections/community.general/pull/6428)."
- "puppet - the alias ``show-diff`` of the ``show_diff`` option has been removed. Use ``show_diff`` instead (https://github.com/ansible-collections/community.general/pull/6428)."
- "cmd_runner module utils - the ``fmt`` alias of ``cmd_runner_fmt`` has been removed. Use ``cmd_runner_fmt`` instead (https://github.com/ansible-collections/community.general/pull/6428)."

View file

@ -5,7 +5,7 @@
namespace: community namespace: community
name: general name: general
version: 6.6.0 version: 7.0.0
readme: README.md readme: README.md
authors: authors:
- Ansible (https://github.com/ansible) - Ansible (https://github.com/ansible)

View file

@ -309,11 +309,3 @@ class _CmdRunnerContext(object):
cmd_runner_fmt = _Format() cmd_runner_fmt = _Format()
#
# The fmt form is deprecated and will be removed in community.general 7.0.0
# Please use:
# cmd_runner_fmt
# Or, to retain the same effect, use:
# from ansible_collections.community.general.plugins.module_utils.cmd_runner import cmd_runner_fmt as fmt
fmt = cmd_runner_fmt

View file

@ -114,8 +114,9 @@ options:
- Whether the runner should be registered with an access level or not. - Whether the runner should be registered with an access level or not.
- If set to C(true), the value of I(access_level) is used for runner registration. - If set to C(true), the value of I(access_level) is used for runner registration.
- If set to C(false), GitLab registers the runner with the default access level. - If set to C(false), GitLab registers the runner with the default access level.
- The current default of this option is C(false). This default is deprecated and will change to C(true) in commuinty.general 7.0.0. - The default of this option changed to C(true) in community.general 7.0.0. Before, it was C(false).
required: false required: false
default: true
type: bool type: bool
version_added: 6.3.0 version_added: 6.3.0
maximum_timeout: maximum_timeout:
@ -252,13 +253,6 @@ class GitLabRunner(object):
arguments['token'] = options['registration_token'] arguments['token'] = options['registration_token']
access_level_on_creation = self._module.params['access_level_on_creation'] access_level_on_creation = self._module.params['access_level_on_creation']
if access_level_on_creation is None:
message = "The option 'access_level_on_creation' is unspecified, so 'false' is assumed. "\
"That means any value of 'access_level' is ignored and GitLab registers the runner with its default value. "\
"The option 'access_level_on_creation' will switch to 'true' in community.general 7.0.0"
self._module.deprecate(message, version='7.0.0', collection_name='community.general')
access_level_on_creation = False
if not access_level_on_creation: if not access_level_on_creation:
arguments.pop('access_level', None) arguments.pop('access_level', None)
@ -366,7 +360,7 @@ def main():
run_untagged=dict(type='bool', default=True), run_untagged=dict(type='bool', default=True),
locked=dict(type='bool', default=False), locked=dict(type='bool', default=False),
access_level=dict(type='str', choices=["not_protected", "ref_protected"]), access_level=dict(type='str', choices=["not_protected", "ref_protected"]),
access_level_on_creation=dict(type='bool'), access_level_on_creation=dict(type='bool', default=True),
maximum_timeout=dict(type='int', default=3600), maximum_timeout=dict(type='int', default=3600),
registration_token=dict(type='str', no_log=True), registration_token=dict(type='str', no_log=True),
project=dict(type='str'), project=dict(type='str'),

View file

@ -61,18 +61,6 @@ options:
description: description:
- The name of the user/process that triggered this deployment - The name of the user/process that triggered this deployment
required: false required: false
appname:
type: str
description:
- Name of the application.
- This option has been deprecated and will be removed in community.general 7.0.0. Please do not use.
required: false
environment:
type: str
description:
- The environment for this deployment.
- This option has been deprecated and will be removed community.general 7.0.0. Please do not use.
required: false
validate_certs: validate_certs:
description: description:
- If C(false), SSL certificates will not be validated. This should only be used - If C(false), SSL certificates will not be validated. This should only be used
@ -113,8 +101,6 @@ def main():
description=dict(required=False), description=dict(required=False),
revision=dict(required=True), revision=dict(required=True),
user=dict(required=False), user=dict(required=False),
appname=dict(required=False, removed_in_version='7.0.0', removed_from_collection='community.general'),
environment=dict(required=False, removed_in_version='7.0.0', removed_from_collection='community.general'),
validate_certs=dict(default=True, type='bool'), validate_certs=dict(default=True, type='bool'),
), ),
required_one_of=[['app_name', 'application_id']], required_one_of=[['app_name', 'application_id']],

View file

@ -397,9 +397,9 @@ options:
description: description:
- This is only used with 'bridge-slave' - 'hairpin mode' for the slave, which allows frames to be sent back out through the slave the - This is only used with 'bridge-slave' - 'hairpin mode' for the slave, which allows frames to be sent back out through the slave the
frame was received on. frame was received on.
- The default value is C(true), but that is being deprecated - The default change to C(false) in community.general 7.0.0. It used to be C(true) before.
and it will be changed to C(false) in community.general 7.0.0.
type: bool type: bool
default: false
runner: runner:
description: description:
- This is the type of device or network connection that you wish to create for a team. - This is the type of device or network connection that you wish to create for a team.
@ -1519,8 +1519,7 @@ class Nmcli(object):
self.hellotime = module.params['hellotime'] self.hellotime = module.params['hellotime']
self.maxage = module.params['maxage'] self.maxage = module.params['maxage']
self.ageingtime = module.params['ageingtime'] self.ageingtime = module.params['ageingtime']
# hairpin should be back to normal in 7.0.0 self.hairpin = module.params['hairpin']
self._hairpin = module.params['hairpin']
self.path_cost = module.params['path_cost'] self.path_cost = module.params['path_cost']
self.mac = module.params['mac'] self.mac = module.params['mac']
self.runner = module.params['runner'] self.runner = module.params['runner']
@ -1571,18 +1570,6 @@ class Nmcli(object):
self.edit_commands = [] self.edit_commands = []
@property
def hairpin(self):
if self._hairpin is None:
self.module.deprecate(
"Parameter 'hairpin' default value will change from true to false in community.general 7.0.0. "
"Set the value explicitly to suppress this warning.",
version='7.0.0', collection_name='community.general',
)
# Should be False in 7.0.0 but then that should be in argument_specs
self._hairpin = True
return self._hairpin
def execute_command(self, cmd, use_unsafe_shell=False, data=None): def execute_command(self, cmd, use_unsafe_shell=False, data=None):
if isinstance(cmd, list): if isinstance(cmd, list):
cmd = [to_text(item) for item in cmd] cmd = [to_text(item) for item in cmd]
@ -2366,7 +2353,7 @@ def main():
hellotime=dict(type='int', default=2), hellotime=dict(type='int', default=2),
maxage=dict(type='int', default=20), maxage=dict(type='int', default=20),
ageingtime=dict(type='int', default=300), ageingtime=dict(type='int', default=300),
hairpin=dict(type='bool'), hairpin=dict(type='bool', default=False),
path_cost=dict(type='int', default=100), path_cost=dict(type='int', default=100),
# team specific vars # team specific vars
runner=dict(type='str', default='roundrobin', runner=dict(type='str', default='roundrobin',

View file

@ -154,10 +154,9 @@ options:
unprivileged: unprivileged:
description: description:
- Indicate if the container should be unprivileged. - Indicate if the container should be unprivileged.
- > - The default change to C(true) in community.general 7.0.0. It used to be C(false) before.
The default value for this parameter is C(false) but that is deprecated
and it will be replaced with C(true) in community.general 7.0.0.
type: bool type: bool
default: true
description: description:
description: description:
- Specify the description for the container. Only used on the configuration web interface. - Specify the description for the container. Only used on the configuration web interface.
@ -600,7 +599,7 @@ def main():
purge=dict(type='bool', default=False), purge=dict(type='bool', default=False),
state=dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted']), state=dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted']),
pubkey=dict(type='str'), pubkey=dict(type='str'),
unprivileged=dict(type='bool'), unprivileged=dict(type='bool', default=True),
description=dict(type='str'), description=dict(type='str'),
hookscript=dict(type='str'), hookscript=dict(type='str'),
proxmox_default_behavior=dict(type='str', default='no_defaults', choices=['compatibility', 'no_defaults']), proxmox_default_behavior=dict(type='str', default='no_defaults', choices=['compatibility', 'no_defaults']),
@ -643,14 +642,6 @@ def main():
timeout = module.params['timeout'] timeout = module.params['timeout']
clone = module.params['clone'] clone = module.params['clone']
if module.params['unprivileged'] is None:
module.params['unprivileged'] = False
module.deprecate(
'The default value `false` for the parameter "unprivileged" is deprecated and it will be replaced with `true`',
version='7.0.0',
collection_name='community.general'
)
if module.params['proxmox_default_behavior'] == 'compatibility': if module.params['proxmox_default_behavior'] == 'compatibility':
old_default_values = dict( old_default_values = dict(
disk="3", disk="3",

View file

@ -114,8 +114,6 @@ options:
show_diff: show_diff:
description: description:
- Whether to print file changes details - Whether to print file changes details
- Alias C(show-diff) has been deprecated and will be removed in community.general 7.0.0.
aliases: ['show-diff']
type: bool type: bool
default: false default: false
requirements: requirements:
@ -198,9 +196,7 @@ def main():
noop=dict(type='bool'), noop=dict(type='bool'),
logdest=dict(type='str', default='stdout', choices=['all', 'stdout', 'syslog']), logdest=dict(type='str', default='stdout', choices=['all', 'stdout', 'syslog']),
# The following is not related to Ansible's diff; see https://github.com/ansible-collections/community.general/pull/3980#issuecomment-1005666154 # The following is not related to Ansible's diff; see https://github.com/ansible-collections/community.general/pull/3980#issuecomment-1005666154
show_diff=dict( show_diff=dict(type='bool', default=False),
type='bool', default=False, aliases=['show-diff'],
deprecated_aliases=[dict(name='show-diff', version='7.0.0', collection_name='community.general')]),
facts=dict(type='dict'), facts=dict(type='dict'),
facter_basename=dict(type='str', default='ansible'), facter_basename=dict(type='str', default='ansible'),
environment=dict(type='str'), environment=dict(type='str'),

View file

@ -18,7 +18,6 @@ plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter
plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0 plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
plugins/modules/parted.py validate-modules:parameter-state-invalid-choice plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
plugins/modules/puppet.py validate-modules:parameter-invalid # invalid alias - removed in 7.0.0
plugins/modules/rax_files_objects.py use-argspec-type-path # module deprecated - removed in 9.0.0 plugins/modules/rax_files_objects.py use-argspec-type-path # module deprecated - removed in 9.0.0
plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice # module deprecated - removed in 9.0.0 plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice # module deprecated - removed in 9.0.0
plugins/modules/rax.py use-argspec-type-path # module deprecated - removed in 9.0.0 plugins/modules/rax.py use-argspec-type-path # module deprecated - removed in 9.0.0

View file

@ -13,7 +13,6 @@ plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter
plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0 plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
plugins/modules/parted.py validate-modules:parameter-state-invalid-choice plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
plugins/modules/puppet.py validate-modules:parameter-invalid # invalid alias - removed in 7.0.0
plugins/modules/rax_files_objects.py use-argspec-type-path # module deprecated - removed in 9.0.0 plugins/modules/rax_files_objects.py use-argspec-type-path # module deprecated - removed in 9.0.0
plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice # module deprecated - removed in 9.0.0 plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice # module deprecated - removed in 9.0.0
plugins/modules/rax.py use-argspec-type-path # module deprecated - removed in 9.0.0 plugins/modules/rax.py use-argspec-type-path # module deprecated - removed in 9.0.0

View file

@ -13,7 +13,6 @@ plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter
plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0 plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
plugins/modules/parted.py validate-modules:parameter-state-invalid-choice plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
plugins/modules/puppet.py validate-modules:parameter-invalid # invalid alias - removed in 7.0.0
plugins/modules/rax_files_objects.py use-argspec-type-path # module deprecated - removed in 9.0.0 plugins/modules/rax_files_objects.py use-argspec-type-path # module deprecated - removed in 9.0.0
plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice # module deprecated - removed in 9.0.0 plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice # module deprecated - removed in 9.0.0
plugins/modules/rax.py use-argspec-type-path # module deprecated - removed in 9.0.0 plugins/modules/rax.py use-argspec-type-path # module deprecated - removed in 9.0.0

View file

@ -14,7 +14,6 @@ plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter
plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0 plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
plugins/modules/parted.py validate-modules:parameter-state-invalid-choice plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
plugins/modules/puppet.py validate-modules:parameter-invalid # invalid alias - removed in 7.0.0
plugins/modules/rax_files_objects.py use-argspec-type-path # module deprecated - removed in 9.0.0 plugins/modules/rax_files_objects.py use-argspec-type-path # module deprecated - removed in 9.0.0
plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice # module deprecated - removed in 9.0.0 plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice # module deprecated - removed in 9.0.0
plugins/modules/rax.py use-argspec-type-path # module deprecated - removed in 9.0.0 plugins/modules/rax.py use-argspec-type-path # module deprecated - removed in 9.0.0

View file

@ -14,7 +14,6 @@ plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter
plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0 plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
plugins/modules/parted.py validate-modules:parameter-state-invalid-choice plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
plugins/modules/puppet.py validate-modules:parameter-invalid # invalid alias - removed in 7.0.0
plugins/modules/rax_files_objects.py use-argspec-type-path # module deprecated - removed in 9.0.0 plugins/modules/rax_files_objects.py use-argspec-type-path # module deprecated - removed in 9.0.0
plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice # module deprecated - removed in 9.0.0 plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice # module deprecated - removed in 9.0.0
plugins/modules/rax.py use-argspec-type-path # module deprecated - removed in 9.0.0 plugins/modules/rax.py use-argspec-type-path # module deprecated - removed in 9.0.0

View file

@ -14,7 +14,6 @@ plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter
plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0 plugins/modules/manageiq_tags.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
plugins/modules/parted.py validate-modules:parameter-state-invalid-choice plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
plugins/modules/puppet.py validate-modules:parameter-invalid # invalid alias - removed in 7.0.0
plugins/modules/rax_files_objects.py use-argspec-type-path # module deprecated - removed in 9.0.0 plugins/modules/rax_files_objects.py use-argspec-type-path # module deprecated - removed in 9.0.0
plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice # module deprecated - removed in 9.0.0 plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice # module deprecated - removed in 9.0.0
plugins/modules/rax.py use-argspec-type-path # module deprecated - removed in 9.0.0 plugins/modules/rax.py use-argspec-type-path # module deprecated - removed in 9.0.0

View file

@ -11,44 +11,44 @@ from sys import version_info
import pytest import pytest
from ansible_collections.community.general.tests.unit.compat.mock import MagicMock, PropertyMock from ansible_collections.community.general.tests.unit.compat.mock import MagicMock, PropertyMock
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, fmt from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt
TC_FORMATS = dict( TC_FORMATS = dict(
simple_boolean__true=(fmt.as_bool, ("--superflag",), True, ["--superflag"]), simple_boolean__true=(cmd_runner_fmt.as_bool, ("--superflag",), True, ["--superflag"]),
simple_boolean__false=(fmt.as_bool, ("--superflag",), False, []), simple_boolean__false=(cmd_runner_fmt.as_bool, ("--superflag",), False, []),
simple_boolean__none=(fmt.as_bool, ("--superflag",), None, []), simple_boolean__none=(cmd_runner_fmt.as_bool, ("--superflag",), None, []),
simple_boolean_both__true=(fmt.as_bool, ("--superflag", "--falseflag"), True, ["--superflag"]), simple_boolean_both__true=(cmd_runner_fmt.as_bool, ("--superflag", "--falseflag"), True, ["--superflag"]),
simple_boolean_both__false=(fmt.as_bool, ("--superflag", "--falseflag"), False, ["--falseflag"]), simple_boolean_both__false=(cmd_runner_fmt.as_bool, ("--superflag", "--falseflag"), False, ["--falseflag"]),
simple_boolean_both__none=(fmt.as_bool, ("--superflag", "--falseflag"), None, ["--falseflag"]), simple_boolean_both__none=(cmd_runner_fmt.as_bool, ("--superflag", "--falseflag"), None, ["--falseflag"]),
simple_boolean_both__none_ig=(fmt.as_bool, ("--superflag", "--falseflag", True), None, []), simple_boolean_both__none_ig=(cmd_runner_fmt.as_bool, ("--superflag", "--falseflag", True), None, []),
simple_boolean_not__true=(fmt.as_bool_not, ("--superflag",), True, []), simple_boolean_not__true=(cmd_runner_fmt.as_bool_not, ("--superflag",), True, []),
simple_boolean_not__false=(fmt.as_bool_not, ("--superflag",), False, ["--superflag"]), simple_boolean_not__false=(cmd_runner_fmt.as_bool_not, ("--superflag",), False, ["--superflag"]),
simple_boolean_not__none=(fmt.as_bool_not, ("--superflag",), None, ["--superflag"]), simple_boolean_not__none=(cmd_runner_fmt.as_bool_not, ("--superflag",), None, ["--superflag"]),
simple_optval__str=(fmt.as_optval, ("-t",), "potatoes", ["-tpotatoes"]), simple_optval__str=(cmd_runner_fmt.as_optval, ("-t",), "potatoes", ["-tpotatoes"]),
simple_optval__int=(fmt.as_optval, ("-t",), 42, ["-t42"]), simple_optval__int=(cmd_runner_fmt.as_optval, ("-t",), 42, ["-t42"]),
simple_opt_val__str=(fmt.as_opt_val, ("-t",), "potatoes", ["-t", "potatoes"]), simple_opt_val__str=(cmd_runner_fmt.as_opt_val, ("-t",), "potatoes", ["-t", "potatoes"]),
simple_opt_val__int=(fmt.as_opt_val, ("-t",), 42, ["-t", "42"]), simple_opt_val__int=(cmd_runner_fmt.as_opt_val, ("-t",), 42, ["-t", "42"]),
simple_opt_eq_val__str=(fmt.as_opt_eq_val, ("--food",), "potatoes", ["--food=potatoes"]), simple_opt_eq_val__str=(cmd_runner_fmt.as_opt_eq_val, ("--food",), "potatoes", ["--food=potatoes"]),
simple_opt_eq_val__int=(fmt.as_opt_eq_val, ("--answer",), 42, ["--answer=42"]), simple_opt_eq_val__int=(cmd_runner_fmt.as_opt_eq_val, ("--answer",), 42, ["--answer=42"]),
simple_list_potato=(fmt.as_list, (), "literal_potato", ["literal_potato"]), simple_list_potato=(cmd_runner_fmt.as_list, (), "literal_potato", ["literal_potato"]),
simple_list_42=(fmt.as_list, (), 42, ["42"]), simple_list_42=(cmd_runner_fmt.as_list, (), 42, ["42"]),
simple_map=(fmt.as_map, ({'a': 1, 'b': 2, 'c': 3},), 'b', ["2"]), simple_map=(cmd_runner_fmt.as_map, ({'a': 1, 'b': 2, 'c': 3},), 'b', ["2"]),
simple_default_type__list=(fmt.as_default_type, ("list",), [1, 2, 3, 5, 8], ["--1", "--2", "--3", "--5", "--8"]), simple_default_type__list=(cmd_runner_fmt.as_default_type, ("list",), [1, 2, 3, 5, 8], ["--1", "--2", "--3", "--5", "--8"]),
simple_default_type__bool_true=(fmt.as_default_type, ("bool", "what"), True, ["--what"]), simple_default_type__bool_true=(cmd_runner_fmt.as_default_type, ("bool", "what"), True, ["--what"]),
simple_default_type__bool_false=(fmt.as_default_type, ("bool", "what"), False, []), simple_default_type__bool_false=(cmd_runner_fmt.as_default_type, ("bool", "what"), False, []),
simple_default_type__potato=(fmt.as_default_type, ("any-other-type", "potato"), "42", ["--potato", "42"]), simple_default_type__potato=(cmd_runner_fmt.as_default_type, ("any-other-type", "potato"), "42", ["--potato", "42"]),
simple_fixed_true=(fmt.as_fixed, [("--always-here", "--forever")], True, ["--always-here", "--forever"]), simple_fixed_true=(cmd_runner_fmt.as_fixed, [("--always-here", "--forever")], True, ["--always-here", "--forever"]),
simple_fixed_false=(fmt.as_fixed, [("--always-here", "--forever")], False, ["--always-here", "--forever"]), simple_fixed_false=(cmd_runner_fmt.as_fixed, [("--always-here", "--forever")], False, ["--always-here", "--forever"]),
simple_fixed_none=(fmt.as_fixed, [("--always-here", "--forever")], None, ["--always-here", "--forever"]), simple_fixed_none=(cmd_runner_fmt.as_fixed, [("--always-here", "--forever")], None, ["--always-here", "--forever"]),
simple_fixed_str=(fmt.as_fixed, [("--always-here", "--forever")], "something", ["--always-here", "--forever"]), simple_fixed_str=(cmd_runner_fmt.as_fixed, [("--always-here", "--forever")], "something", ["--always-here", "--forever"]),
) )
if tuple(version_info) >= (3, 1): if tuple(version_info) >= (3, 1):
from collections import OrderedDict from collections import OrderedDict
# needs OrderedDict to provide a consistent key order # needs OrderedDict to provide a consistent key order
TC_FORMATS["simple_default_type__dict"] = ( # type: ignore TC_FORMATS["simple_default_type__dict"] = ( # type: ignore
fmt.as_default_type, cmd_runner_fmt.as_default_type,
("dict",), ("dict",),
OrderedDict((('a', 1), ('b', 2))), OrderedDict((('a', 1), ('b', 2))),
["--a=1", "--b=2"] ["--a=1", "--b=2"]
@ -76,11 +76,11 @@ TC_RUNNER = dict(
# param1=dict( # param1=dict(
# type="int", # type="int",
# value=11, # value=11,
# fmt_func=fmt.as_opt_eq_val, # fmt_func=cmd_runner_fmt.as_opt_eq_val,
# fmt_arg="--answer", # fmt_arg="--answer",
# ), # ),
# param2=dict( # param2=dict(
# fmt_func=fmt.as_bool, # fmt_func=cmd_runner_fmt.as_bool,
# fmt_arg="--bb-here", # fmt_arg="--bb-here",
# ) # )
# ), # ),
@ -119,8 +119,8 @@ TC_RUNNER = dict(
aa_bb=( aa_bb=(
dict( dict(
args_bundle=dict( args_bundle=dict(
aa=dict(type="int", value=11, fmt_func=fmt.as_opt_eq_val, fmt_arg="--answer"), aa=dict(type="int", value=11, fmt_func=cmd_runner_fmt.as_opt_eq_val, fmt_arg="--answer"),
bb=dict(fmt_func=fmt.as_bool, fmt_arg="--bb-here"), bb=dict(fmt_func=cmd_runner_fmt.as_bool, fmt_arg="--bb-here"),
), ),
runner_init_args=dict(), runner_init_args=dict(),
runner_ctx_args=dict(args_order=['aa', 'bb']), runner_ctx_args=dict(args_order=['aa', 'bb']),
@ -137,8 +137,8 @@ TC_RUNNER = dict(
aa_bb_default_order=( aa_bb_default_order=(
dict( dict(
args_bundle=dict( args_bundle=dict(
aa=dict(type="int", value=11, fmt_func=fmt.as_opt_eq_val, fmt_arg="--answer"), aa=dict(type="int", value=11, fmt_func=cmd_runner_fmt.as_opt_eq_val, fmt_arg="--answer"),
bb=dict(fmt_func=fmt.as_bool, fmt_arg="--bb-here"), bb=dict(fmt_func=cmd_runner_fmt.as_bool, fmt_arg="--bb-here"),
), ),
runner_init_args=dict(default_args_order=['bb', 'aa']), runner_init_args=dict(default_args_order=['bb', 'aa']),
runner_ctx_args=dict(), runner_ctx_args=dict(),
@ -155,8 +155,8 @@ TC_RUNNER = dict(
aa_bb_default_order_args_order=( aa_bb_default_order_args_order=(
dict( dict(
args_bundle=dict( args_bundle=dict(
aa=dict(type="int", value=11, fmt_func=fmt.as_opt_eq_val, fmt_arg="--answer"), aa=dict(type="int", value=11, fmt_func=cmd_runner_fmt.as_opt_eq_val, fmt_arg="--answer"),
bb=dict(fmt_func=fmt.as_bool, fmt_arg="--bb-here"), bb=dict(fmt_func=cmd_runner_fmt.as_bool, fmt_arg="--bb-here"),
), ),
runner_init_args=dict(default_args_order=['bb', 'aa']), runner_init_args=dict(default_args_order=['bb', 'aa']),
runner_ctx_args=dict(args_order=['aa', 'bb']), runner_ctx_args=dict(args_order=['aa', 'bb']),
@ -173,8 +173,8 @@ TC_RUNNER = dict(
aa_bb_dup_in_args_order=( aa_bb_dup_in_args_order=(
dict( dict(
args_bundle=dict( args_bundle=dict(
aa=dict(type="int", value=11, fmt_func=fmt.as_opt_eq_val, fmt_arg="--answer"), aa=dict(type="int", value=11, fmt_func=cmd_runner_fmt.as_opt_eq_val, fmt_arg="--answer"),
bb=dict(fmt_func=fmt.as_bool, fmt_arg="--bb-here"), bb=dict(fmt_func=cmd_runner_fmt.as_bool, fmt_arg="--bb-here"),
), ),
runner_init_args=dict(), runner_init_args=dict(),
runner_ctx_args=dict(args_order=['aa', 'bb', 'aa']), runner_ctx_args=dict(args_order=['aa', 'bb', 'aa']),
@ -189,8 +189,8 @@ TC_RUNNER = dict(
aa_bb_process_output=( aa_bb_process_output=(
dict( dict(
args_bundle=dict( args_bundle=dict(
aa=dict(type="int", value=11, fmt_func=fmt.as_opt_eq_val, fmt_arg="--answer"), aa=dict(type="int", value=11, fmt_func=cmd_runner_fmt.as_opt_eq_val, fmt_arg="--answer"),
bb=dict(fmt_func=fmt.as_bool, fmt_arg="--bb-here"), bb=dict(fmt_func=cmd_runner_fmt.as_bool, fmt_arg="--bb-here"),
), ),
runner_init_args=dict(default_args_order=['bb', 'aa']), runner_init_args=dict(default_args_order=['bb', 'aa']),
runner_ctx_args=dict( runner_ctx_args=dict(
@ -209,8 +209,8 @@ TC_RUNNER = dict(
aa_bb_ignore_none_with_none=( aa_bb_ignore_none_with_none=(
dict( dict(
args_bundle=dict( args_bundle=dict(
aa=dict(type="int", value=49, fmt_func=fmt.as_opt_eq_val, fmt_arg="--answer"), aa=dict(type="int", value=49, fmt_func=cmd_runner_fmt.as_opt_eq_val, fmt_arg="--answer"),
bb=dict(fmt_func=fmt.as_bool, fmt_arg="--bb-here"), bb=dict(fmt_func=cmd_runner_fmt.as_bool, fmt_arg="--bb-here"),
), ),
runner_init_args=dict(default_args_order=['bb', 'aa']), runner_init_args=dict(default_args_order=['bb', 'aa']),
runner_ctx_args=dict( runner_ctx_args=dict(
@ -228,8 +228,8 @@ TC_RUNNER = dict(
aa_bb_ignore_not_none_with_none=( aa_bb_ignore_not_none_with_none=(
dict( dict(
args_bundle=dict( args_bundle=dict(
aa=dict(type="int", value=49, fmt_func=fmt.as_opt_eq_val, fmt_arg="--answer"), aa=dict(type="int", value=49, fmt_func=cmd_runner_fmt.as_opt_eq_val, fmt_arg="--answer"),
bb=dict(fmt_func=fmt.as_bool, fmt_arg="--bb-here"), bb=dict(fmt_func=cmd_runner_fmt.as_bool, fmt_arg="--bb-here"),
), ),
runner_init_args=dict(default_args_order=['bb', 'aa']), runner_init_args=dict(default_args_order=['bb', 'aa']),
runner_ctx_args=dict( runner_ctx_args=dict(
@ -247,8 +247,8 @@ TC_RUNNER = dict(
aa_bb_fixed=( aa_bb_fixed=(
dict( dict(
args_bundle=dict( args_bundle=dict(
aa=dict(type="int", value=11, fmt_func=fmt.as_opt_eq_val, fmt_arg="--answer"), aa=dict(type="int", value=11, fmt_func=cmd_runner_fmt.as_opt_eq_val, fmt_arg="--answer"),
bb=dict(fmt_func=fmt.as_fixed, fmt_arg=["fixed", "args"]), bb=dict(fmt_func=cmd_runner_fmt.as_fixed, fmt_arg=["fixed", "args"]),
), ),
runner_init_args=dict(), runner_init_args=dict(),
runner_ctx_args=dict(args_order=['aa', 'bb']), runner_ctx_args=dict(args_order=['aa', 'bb']),
@ -265,8 +265,8 @@ TC_RUNNER = dict(
aa_bb_map=( aa_bb_map=(
dict( dict(
args_bundle=dict( args_bundle=dict(
aa=dict(type="int", value=11, fmt_func=fmt.as_opt_eq_val, fmt_arg="--answer"), aa=dict(type="int", value=11, fmt_func=cmd_runner_fmt.as_opt_eq_val, fmt_arg="--answer"),
bb=dict(fmt_func=fmt.as_map, fmt_arg={"v1": 111, "v2": 222}), bb=dict(fmt_func=cmd_runner_fmt.as_map, fmt_arg={"v1": 111, "v2": 222}),
), ),
runner_init_args=dict(), runner_init_args=dict(),
runner_ctx_args=dict(args_order=['aa', 'bb']), runner_ctx_args=dict(args_order=['aa', 'bb']),
@ -283,8 +283,8 @@ TC_RUNNER = dict(
aa_bb_map_default=( aa_bb_map_default=(
dict( dict(
args_bundle=dict( args_bundle=dict(
aa=dict(type="int", value=11, fmt_func=fmt.as_opt_eq_val, fmt_arg="--answer"), aa=dict(type="int", value=11, fmt_func=cmd_runner_fmt.as_opt_eq_val, fmt_arg="--answer"),
bb=dict(fmt_func=fmt.as_map, fmt_arg={"v1": 111, "v2": 222}), bb=dict(fmt_func=cmd_runner_fmt.as_map, fmt_arg={"v1": 111, "v2": 222}),
), ),
runner_init_args=dict(), runner_init_args=dict(),
runner_ctx_args=dict(args_order=['aa', 'bb']), runner_ctx_args=dict(args_order=['aa', 'bb']),

View file

@ -568,6 +568,7 @@ TESTCASE_BRIDGE_SLAVE = [
'type': 'bridge-slave', 'type': 'bridge-slave',
'conn_name': 'non_existent_nw_device', 'conn_name': 'non_existent_nw_device',
'ifname': 'br0_non_existant', 'ifname': 'br0_non_existant',
'hairpin': True,
'path_cost': 100, 'path_cost': 100,
'state': 'present', 'state': 'present',
'_ansible_check_mode': False, '_ansible_check_mode': False,