mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Bump version of main to 8.0.0; remove deprecations, deprecate some leftovers (#7358)
* Remove disable_facts from xfconf module. * Remove deprecated module_helper CmdMixin and users. * Deprecate ArgFormat as well, which wasn't explicitly deprecated yet. * Remove state=get from gconftool2. * Remove default of access_level in gitlab_runner. * Remove state=list from manageiq_polices. * Remove state=list from manageiq_tags. * Consul: when state=absent, certain options can no longer be specified. * Remove support for Ansible 2.9 and ansible-base 2.10 from ansible_galaxy_install. * Bump community.general version to 8.0.0. * Fix gconftool2 tests. * Remove mh.mixins.cmd module_utils completely. * Re-add removed anchor on its first non-removed usage. * remove references in return doc, refactor method _setup210plus * remove no longer needed check in function parse_check * improve expression * Fix YAML. * Lint. --------- Co-authored-by: Alexei Znamensky <russoz@gmail.com>
This commit is contained in:
parent
c7084c6c30
commit
40809ed953
21 changed files with 88 additions and 514 deletions
15
changelogs/fragments/removals.yml
Normal file
15
changelogs/fragments/removals.yml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
removed_features:
|
||||||
|
- "xfconf - the deprecated ``disable_facts`` option was removed (https://github.com/ansible-collections/community.general/pull/7358)."
|
||||||
|
- "mh.mixins.cmd module utils - the ``ArgFormat`` class has been removed (https://github.com/ansible-collections/community.general/pull/7358)."
|
||||||
|
- "mh.mixins.cmd module utils - the ``CmdMixin`` mixin has been removed. Use ``community.general.plugins.module_utils.cmd_runner.CmdRunner`` instead (https://github.com/ansible-collections/community.general/pull/7358)."
|
||||||
|
- "mh.mixins.cmd module utils - the mh.mixins.cmd module utils has been removed after all its contents were removed (https://github.com/ansible-collections/community.general/pull/7358)."
|
||||||
|
- "mh.module_helper module utils - the ``CmdModuleHelper`` and ``CmdStateModuleHelper`` classes have been removed. Use ``community.general.plugins.module_utils.cmd_runner.CmdRunner`` instead (https://github.com/ansible-collections/community.general/pull/7358)."
|
||||||
|
- "ansible_galaxy_install - support for Ansible 2.9 and ansible-base 2.10 has been removed (https://github.com/ansible-collections/community.general/pull/7358)."
|
||||||
|
- "consul - when ``state=absent``, the options ``script``, ``ttl``, ``tcp``, ``http``, and ``interval`` can no longer be specified (https://github.com/ansible-collections/community.general/pull/7358)."
|
||||||
|
- "gconftool2 - ``state=get`` has been removed. Use the module ``community.general.gconftool2_info`` instead (https://github.com/ansible-collections/community.general/pull/7358)."
|
||||||
|
- "gitlab_runner - remove the default value for the ``access_level`` option. To restore the previous behavior, explicitly set it to ``ref_protected`` (https://github.com/ansible-collections/community.general/pull/7358)."
|
||||||
|
- "manageiq_polices - ``state=list`` has been removed. Use the module ``community.general.manageiq_policies_info`` instead (https://github.com/ansible-collections/community.general/pull/7358)."
|
||||||
|
- "manageiq_tags - ``state=list`` has been removed. Use the module ``community.general.manageiq_tags_info`` instead (https://github.com/ansible-collections/community.general/pull/7358)."
|
||||||
|
deprecated_features:
|
||||||
|
- "consul - the ``ack_params_state_absent`` option has been deprecated and will be removed in community.general 10.0.0 (https://github.com/ansible-collections/community.general/pull/7358)."
|
||||||
|
- "ansible_galaxy_install - the ``ack_ansible29`` and ``ack_min_ansiblecore211`` options have been deprecated and will be removed in community.general 9.0.0 (https://github.com/ansible-collections/community.general/pull/7358)."
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
namespace: community
|
namespace: community
|
||||||
name: general
|
name: general
|
||||||
version: 7.5.0
|
version: 8.0.0
|
||||||
readme: README.md
|
readme: README.md
|
||||||
authors:
|
authors:
|
||||||
- Ansible (https://github.com/ansible)
|
- Ansible (https://github.com/ansible)
|
||||||
|
|
|
@ -1,205 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# (c) 2020, Alexei Znamensky <russoz@gmail.com>
|
|
||||||
# Copyright (c) 2020, Ansible Project
|
|
||||||
# Simplified BSD License (see LICENSES/BSD-2-Clause.txt or https://opensource.org/licenses/BSD-2-Clause)
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
from functools import partial
|
|
||||||
|
|
||||||
|
|
||||||
class ArgFormat(object):
|
|
||||||
"""
|
|
||||||
Argument formatter for use as a command line parameter. Used in CmdMixin.
|
|
||||||
"""
|
|
||||||
BOOLEAN = 0
|
|
||||||
PRINTF = 1
|
|
||||||
FORMAT = 2
|
|
||||||
BOOLEAN_NOT = 3
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def stars_deco(num):
|
|
||||||
if num == 1:
|
|
||||||
def deco(f):
|
|
||||||
return lambda v: f(*v)
|
|
||||||
return deco
|
|
||||||
elif num == 2:
|
|
||||||
def deco(f):
|
|
||||||
return lambda v: f(**v)
|
|
||||||
return deco
|
|
||||||
|
|
||||||
return lambda f: f
|
|
||||||
|
|
||||||
def __init__(self, name, fmt=None, style=FORMAT, stars=0):
|
|
||||||
"""
|
|
||||||
THIS CLASS IS BEING DEPRECATED.
|
|
||||||
It was never meant to be used outside the scope of CmdMixin, and CmdMixin is being deprecated.
|
|
||||||
See the deprecation notice in ``CmdMixin.__init__()`` below.
|
|
||||||
|
|
||||||
Creates a CLI-formatter for one specific argument. The argument may be a module parameter or just a named parameter for
|
|
||||||
the CLI command execution.
|
|
||||||
:param name: Name of the argument to be formatted
|
|
||||||
:param fmt: Either a str to be formatted (using or not printf-style) or a callable that does that
|
|
||||||
:param style: Whether arg_format (as str) should use printf-style formatting.
|
|
||||||
Ignored if arg_format is None or not a str (should be callable).
|
|
||||||
:param stars: A int with 0, 1 or 2 value, indicating to formatting the value as: value, *value or **value
|
|
||||||
"""
|
|
||||||
def printf_fmt(_fmt, v):
|
|
||||||
try:
|
|
||||||
return [_fmt % v]
|
|
||||||
except TypeError as e:
|
|
||||||
if e.args[0] != 'not all arguments converted during string formatting':
|
|
||||||
raise
|
|
||||||
return [_fmt]
|
|
||||||
|
|
||||||
_fmts = {
|
|
||||||
ArgFormat.BOOLEAN: lambda _fmt, v: ([_fmt] if bool(v) else []),
|
|
||||||
ArgFormat.BOOLEAN_NOT: lambda _fmt, v: ([] if bool(v) else [_fmt]),
|
|
||||||
ArgFormat.PRINTF: printf_fmt,
|
|
||||||
ArgFormat.FORMAT: lambda _fmt, v: [_fmt.format(v)],
|
|
||||||
}
|
|
||||||
|
|
||||||
self.name = name
|
|
||||||
self.stars = stars
|
|
||||||
self.style = style
|
|
||||||
|
|
||||||
if fmt is None:
|
|
||||||
fmt = "{0}"
|
|
||||||
style = ArgFormat.FORMAT
|
|
||||||
|
|
||||||
if isinstance(fmt, str):
|
|
||||||
func = _fmts[style]
|
|
||||||
self.arg_format = partial(func, fmt)
|
|
||||||
elif isinstance(fmt, list) or isinstance(fmt, tuple):
|
|
||||||
self.arg_format = lambda v: [_fmts[style](f, v)[0] for f in fmt]
|
|
||||||
elif hasattr(fmt, '__call__'):
|
|
||||||
self.arg_format = fmt
|
|
||||||
else:
|
|
||||||
raise TypeError('Parameter fmt must be either: a string, a list/tuple of '
|
|
||||||
'strings or a function: type={0}, value={1}'.format(type(fmt), fmt))
|
|
||||||
|
|
||||||
if stars:
|
|
||||||
self.arg_format = (self.stars_deco(stars))(self.arg_format)
|
|
||||||
|
|
||||||
def to_text(self, value):
|
|
||||||
if value is None and self.style != ArgFormat.BOOLEAN_NOT:
|
|
||||||
return []
|
|
||||||
func = self.arg_format
|
|
||||||
return [str(p) for p in func(value)]
|
|
||||||
|
|
||||||
|
|
||||||
class CmdMixin(object):
|
|
||||||
"""
|
|
||||||
THIS CLASS IS BEING DEPRECATED.
|
|
||||||
See the deprecation notice in ``CmdMixin.__init__()`` below.
|
|
||||||
|
|
||||||
Mixin for mapping module options to running a CLI command with its arguments.
|
|
||||||
"""
|
|
||||||
command = None
|
|
||||||
command_args_formats = {}
|
|
||||||
run_command_fixed_options = {}
|
|
||||||
check_rc = False
|
|
||||||
force_lang = "C"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def module_formats(self):
|
|
||||||
result = {}
|
|
||||||
for param in self.module.params.keys():
|
|
||||||
result[param] = ArgFormat(param)
|
|
||||||
return result
|
|
||||||
|
|
||||||
@property
|
|
||||||
def custom_formats(self):
|
|
||||||
result = {}
|
|
||||||
for param, fmt_spec in self.command_args_formats.items():
|
|
||||||
result[param] = ArgFormat(param, **fmt_spec)
|
|
||||||
return result
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
super(CmdMixin, self).__init__(*args, **kwargs)
|
|
||||||
self.module.deprecate(
|
|
||||||
'The CmdMixin used in classes CmdModuleHelper and CmdStateModuleHelper is being deprecated. '
|
|
||||||
'Modules should use community.general.plugins.module_utils.cmd_runner.CmdRunner instead.',
|
|
||||||
version='8.0.0',
|
|
||||||
collection_name='community.general',
|
|
||||||
)
|
|
||||||
|
|
||||||
def _calculate_args(self, extra_params=None, params=None):
|
|
||||||
def add_arg_formatted_param(_cmd_args, arg_format, _value):
|
|
||||||
args = list(arg_format.to_text(_value))
|
|
||||||
return _cmd_args + args
|
|
||||||
|
|
||||||
def find_format(_param):
|
|
||||||
return self.custom_formats.get(_param, self.module_formats.get(_param))
|
|
||||||
|
|
||||||
extra_params = extra_params or dict()
|
|
||||||
cmd_args = list([self.command]) if isinstance(self.command, str) else list(self.command)
|
|
||||||
try:
|
|
||||||
cmd_args[0] = self.module.get_bin_path(cmd_args[0], required=True)
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
param_list = params if params else self.vars.keys()
|
|
||||||
|
|
||||||
for param in param_list:
|
|
||||||
if isinstance(param, dict):
|
|
||||||
if len(param) != 1:
|
|
||||||
self.do_raise("run_command parameter as a dict must contain only one key: {0}".format(param))
|
|
||||||
_param = list(param.keys())[0]
|
|
||||||
fmt = find_format(_param)
|
|
||||||
value = param[_param]
|
|
||||||
elif isinstance(param, str):
|
|
||||||
if param in self.vars.keys():
|
|
||||||
fmt = find_format(param)
|
|
||||||
value = self.vars[param]
|
|
||||||
elif param in extra_params:
|
|
||||||
fmt = find_format(param)
|
|
||||||
value = extra_params[param]
|
|
||||||
else:
|
|
||||||
self.do_raise('Cannot determine value for parameter: {0}'.format(param))
|
|
||||||
else:
|
|
||||||
self.do_raise("run_command parameter must be either a str or a dict: {0}".format(param))
|
|
||||||
cmd_args = add_arg_formatted_param(cmd_args, fmt, value)
|
|
||||||
|
|
||||||
return cmd_args
|
|
||||||
|
|
||||||
def process_command_output(self, rc, out, err):
|
|
||||||
return rc, out, err
|
|
||||||
|
|
||||||
def run_command(self,
|
|
||||||
extra_params=None,
|
|
||||||
params=None,
|
|
||||||
process_output=None,
|
|
||||||
publish_rc=True,
|
|
||||||
publish_out=True,
|
|
||||||
publish_err=True,
|
|
||||||
publish_cmd=True,
|
|
||||||
*args, **kwargs):
|
|
||||||
cmd_args = self._calculate_args(extra_params, params)
|
|
||||||
options = dict(self.run_command_fixed_options)
|
|
||||||
options['check_rc'] = options.get('check_rc', self.check_rc)
|
|
||||||
options.update(kwargs)
|
|
||||||
env_update = dict(options.get('environ_update', {}))
|
|
||||||
if self.force_lang:
|
|
||||||
env_update.update({
|
|
||||||
'LANGUAGE': self.force_lang,
|
|
||||||
'LC_ALL': self.force_lang,
|
|
||||||
})
|
|
||||||
self.update_output(force_lang=self.force_lang)
|
|
||||||
options['environ_update'] = env_update
|
|
||||||
rc, out, err = self.module.run_command(cmd_args, *args, **options)
|
|
||||||
if publish_rc:
|
|
||||||
self.update_output(rc=rc)
|
|
||||||
if publish_out:
|
|
||||||
self.update_output(stdout=out)
|
|
||||||
if publish_err:
|
|
||||||
self.update_output(stderr=err)
|
|
||||||
if publish_cmd:
|
|
||||||
self.update_output(cmd_args=cmd_args)
|
|
||||||
if process_output is None:
|
|
||||||
_process = self.process_command_output
|
|
||||||
else:
|
|
||||||
_process = process_output
|
|
||||||
|
|
||||||
return _process(rc, out, err)
|
|
|
@ -12,7 +12,6 @@ from ansible.module_utils.common.dict_transformations import dict_merge
|
||||||
|
|
||||||
# (TODO: remove AnsibleModule!) pylint: disable-next=unused-import
|
# (TODO: remove AnsibleModule!) pylint: disable-next=unused-import
|
||||||
from ansible_collections.community.general.plugins.module_utils.mh.base import ModuleHelperBase, AnsibleModule # noqa: F401
|
from ansible_collections.community.general.plugins.module_utils.mh.base import ModuleHelperBase, AnsibleModule # noqa: F401
|
||||||
from ansible_collections.community.general.plugins.module_utils.mh.mixins.cmd import CmdMixin
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.mh.mixins.state import StateMixin
|
from ansible_collections.community.general.plugins.module_utils.mh.mixins.state import StateMixin
|
||||||
from ansible_collections.community.general.plugins.module_utils.mh.mixins.deps import DependencyMixin
|
from ansible_collections.community.general.plugins.module_utils.mh.mixins.deps import DependencyMixin
|
||||||
from ansible_collections.community.general.plugins.module_utils.mh.mixins.vars import VarsMixin
|
from ansible_collections.community.general.plugins.module_utils.mh.mixins.vars import VarsMixin
|
||||||
|
@ -66,19 +65,3 @@ class ModuleHelper(DeprecateAttrsMixin, VarsMixin, DependencyMixin, ModuleHelper
|
||||||
|
|
||||||
class StateModuleHelper(StateMixin, ModuleHelper):
|
class StateModuleHelper(StateMixin, ModuleHelper):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CmdModuleHelper(CmdMixin, ModuleHelper):
|
|
||||||
"""
|
|
||||||
THIS CLASS IS BEING DEPRECATED.
|
|
||||||
See the deprecation notice in ``CmdMixin.__init__()``.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class CmdStateModuleHelper(CmdMixin, StateMixin, ModuleHelper):
|
|
||||||
"""
|
|
||||||
THIS CLASS IS BEING DEPRECATED.
|
|
||||||
See the deprecation notice in ``CmdMixin.__init__()``.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
|
@ -11,9 +11,8 @@ __metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.mh.module_helper import (
|
from ansible_collections.community.general.plugins.module_utils.mh.module_helper import (
|
||||||
ModuleHelper, StateModuleHelper, CmdModuleHelper, CmdStateModuleHelper, AnsibleModule
|
ModuleHelper, StateModuleHelper, AnsibleModule
|
||||||
)
|
)
|
||||||
from ansible_collections.community.general.plugins.module_utils.mh.mixins.cmd import CmdMixin, ArgFormat # noqa: F401
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.mh.mixins.state import StateMixin # noqa: F401
|
from ansible_collections.community.general.plugins.module_utils.mh.mixins.state import StateMixin # noqa: F401
|
||||||
from ansible_collections.community.general.plugins.module_utils.mh.mixins.deps import DependencyCtxMgr, DependencyMixin # noqa: F401
|
from ansible_collections.community.general.plugins.module_utils.mh.mixins.deps import DependencyCtxMgr, DependencyMixin # noqa: F401
|
||||||
from ansible_collections.community.general.plugins.module_utils.mh.exceptions import ModuleHelperException # noqa: F401
|
from ansible_collections.community.general.plugins.module_utils.mh.exceptions import ModuleHelperException # noqa: F401
|
||||||
|
|
|
@ -17,15 +17,13 @@ version_added: 3.5.0
|
||||||
description:
|
description:
|
||||||
- This module allows the installation of Ansible collections or roles using C(ansible-galaxy).
|
- This module allows the installation of Ansible collections or roles using C(ansible-galaxy).
|
||||||
notes:
|
notes:
|
||||||
- >
|
- Support for B(Ansible 2.9/2.10) was removed in community.general 8.0.0.
|
||||||
B(Ansible 2.9/2.10): The C(ansible-galaxy) command changed significantly between Ansible 2.9 and
|
|
||||||
ansible-base 2.10 (later ansible-core 2.11). See comments in the parameters.
|
|
||||||
- >
|
- >
|
||||||
The module will try and run using the C(C.UTF-8) locale.
|
The module will try and run using the C(C.UTF-8) locale.
|
||||||
If that fails, it will try C(en_US.UTF-8).
|
If that fails, it will try C(en_US.UTF-8).
|
||||||
If that one also fails, the module will fail.
|
If that one also fails, the module will fail.
|
||||||
requirements:
|
requirements:
|
||||||
- Ansible 2.9, ansible-base 2.10, or ansible-core 2.11 or newer
|
- ansible-core 2.11 or newer
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.attributes
|
- community.general.attributes
|
||||||
attributes:
|
attributes:
|
||||||
|
@ -75,24 +73,16 @@ options:
|
||||||
description:
|
description:
|
||||||
- Force overwriting an existing role or collection.
|
- Force overwriting an existing role or collection.
|
||||||
- Using O(force=true) is mandatory when downgrading.
|
- Using O(force=true) is mandatory when downgrading.
|
||||||
- "B(Ansible 2.9 and 2.10): Must be V(true) to upgrade roles and collections."
|
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
ack_ansible29:
|
ack_ansible29:
|
||||||
description:
|
description:
|
||||||
- Acknowledge using Ansible 2.9 with its limitations, and prevents the module from generating warnings about them.
|
- This option has no longer any effect and will be removed in community.general 9.0.0.
|
||||||
- This option is completely ignored if using a version of Ansible greater than C(2.9.x).
|
|
||||||
- Note that this option will be removed without any further deprecation warning once support
|
|
||||||
for Ansible 2.9 is removed from this module.
|
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
ack_min_ansiblecore211:
|
ack_min_ansiblecore211:
|
||||||
description:
|
description:
|
||||||
- Acknowledge the module is deprecating support for Ansible 2.9 and ansible-base 2.10.
|
- This option has no longer any effect and will be removed in community.general 9.0.0.
|
||||||
- Support for those versions will be removed in community.general 8.0.0.
|
|
||||||
At the same time, this option will be removed without any deprecation warning!
|
|
||||||
- This option is completely ignored if using a version of ansible-core/ansible-base/Ansible greater than C(2.11).
|
|
||||||
- For the sake of conciseness, setting this parameter to V(true) implies O(ack_ansible29=true).
|
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
"""
|
"""
|
||||||
|
@ -147,7 +137,6 @@ RETURN = """
|
||||||
description:
|
description:
|
||||||
- If O(requirements_file) is specified instead, returns dictionary with all the roles installed per path.
|
- If O(requirements_file) is specified instead, returns dictionary with all the roles installed per path.
|
||||||
- If O(name) is specified, returns that role name and the version installed per path.
|
- If O(name) is specified, returns that role name and the version installed per path.
|
||||||
- "B(Ansible 2.9): Returns empty because C(ansible-galaxy) has no C(list) subcommand."
|
|
||||||
type: dict
|
type: dict
|
||||||
returned: always when installing roles
|
returned: always when installing roles
|
||||||
contains:
|
contains:
|
||||||
|
@ -164,7 +153,6 @@ RETURN = """
|
||||||
description:
|
description:
|
||||||
- If O(requirements_file) is specified instead, returns dictionary with all the collections installed per path.
|
- If O(requirements_file) is specified instead, returns dictionary with all the collections installed per path.
|
||||||
- If O(name) is specified, returns that collection name and the version installed per path.
|
- If O(name) is specified, returns that collection name and the version installed per path.
|
||||||
- "B(Ansible 2.9): Returns empty because C(ansible-galaxy) has no C(list) subcommand."
|
|
||||||
type: dict
|
type: dict
|
||||||
returned: always when installing collections
|
returned: always when installing collections
|
||||||
contains:
|
contains:
|
||||||
|
@ -206,7 +194,6 @@ class AnsibleGalaxyInstall(ModuleHelper):
|
||||||
_RE_LIST_ROLE = re.compile(r'^- (?P<elem>\w+\.\w+),\s+(?P<version>[\d\.]+)\s*$')
|
_RE_LIST_ROLE = re.compile(r'^- (?P<elem>\w+\.\w+),\s+(?P<version>[\d\.]+)\s*$')
|
||||||
_RE_INSTALL_OUTPUT = None # Set after determining ansible version, see __init_module__()
|
_RE_INSTALL_OUTPUT = None # Set after determining ansible version, see __init_module__()
|
||||||
ansible_version = None
|
ansible_version = None
|
||||||
is_ansible29 = None
|
|
||||||
|
|
||||||
output_params = ('type', 'name', 'dest', 'requirements_file', 'force', 'no_deps')
|
output_params = ('type', 'name', 'dest', 'requirements_file', 'force', 'no_deps')
|
||||||
module = dict(
|
module = dict(
|
||||||
|
@ -217,8 +204,18 @@ class AnsibleGalaxyInstall(ModuleHelper):
|
||||||
dest=dict(type='path'),
|
dest=dict(type='path'),
|
||||||
force=dict(type='bool', default=False),
|
force=dict(type='bool', default=False),
|
||||||
no_deps=dict(type='bool', default=False),
|
no_deps=dict(type='bool', default=False),
|
||||||
ack_ansible29=dict(type='bool', default=False),
|
ack_ansible29=dict(
|
||||||
ack_min_ansiblecore211=dict(type='bool', default=False),
|
type='bool',
|
||||||
|
default=False,
|
||||||
|
removed_in_version='9.0.0',
|
||||||
|
removed_from_collection='community.general',
|
||||||
|
),
|
||||||
|
ack_min_ansiblecore211=dict(
|
||||||
|
type='bool',
|
||||||
|
default=False,
|
||||||
|
removed_in_version='9.0.0',
|
||||||
|
removed_from_collection='community.general',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
mutually_exclusive=[('name', 'requirements_file')],
|
mutually_exclusive=[('name', 'requirements_file')],
|
||||||
required_one_of=[('name', 'requirements_file')],
|
required_one_of=[('name', 'requirements_file')],
|
||||||
|
@ -268,26 +265,22 @@ class AnsibleGalaxyInstall(ModuleHelper):
|
||||||
def __init_module__(self):
|
def __init_module__(self):
|
||||||
# self.runner = CmdRunner(self.module, command=self.command, arg_formats=self.command_args_formats, force_lang=self.force_lang)
|
# self.runner = CmdRunner(self.module, command=self.command, arg_formats=self.command_args_formats, force_lang=self.force_lang)
|
||||||
self.runner, self.ansible_version = self._get_ansible_galaxy_version()
|
self.runner, self.ansible_version = self._get_ansible_galaxy_version()
|
||||||
if self.ansible_version < (2, 11) and not self.vars.ack_min_ansiblecore211:
|
if self.ansible_version < (2, 11):
|
||||||
self.module.deprecate(
|
self.module.fail_json(
|
||||||
"Support for Ansible 2.9 and ansible-base 2.10 is being deprecated. "
|
msg="Support for Ansible 2.9 and ansible-base 2.10 has ben removed."
|
||||||
"At the same time support for them is ended, also the ack_ansible29 option will be removed. "
|
|
||||||
"Upgrading is strongly recommended, or set 'ack_min_ansiblecore211' to suppress this message.",
|
|
||||||
version="8.0.0",
|
|
||||||
collection_name="community.general",
|
|
||||||
)
|
)
|
||||||
self.is_ansible29 = self.ansible_version < (2, 10)
|
|
||||||
if self.is_ansible29:
|
|
||||||
self._RE_INSTALL_OUTPUT = re.compile(r"^(?:.*Installing '(?P<collection>\w+\.\w+):(?P<cversion>[\d\.]+)'.*"
|
|
||||||
r'|- (?P<role>\w+\.\w+) \((?P<rversion>[\d\.]+)\)'
|
|
||||||
r' was installed successfully)$')
|
|
||||||
else:
|
|
||||||
# Collection install output changed:
|
# Collection install output changed:
|
||||||
# ansible-base 2.10: "coll.name (x.y.z)"
|
# ansible-base 2.10: "coll.name (x.y.z)"
|
||||||
# ansible-core 2.11+: "coll.name:x.y.z"
|
# ansible-core 2.11+: "coll.name:x.y.z"
|
||||||
self._RE_INSTALL_OUTPUT = re.compile(r'^(?:(?P<collection>\w+\.\w+)(?: \(|:)(?P<cversion>[\d\.]+)\)?'
|
self._RE_INSTALL_OUTPUT = re.compile(r'^(?:(?P<collection>\w+\.\w+)(?: \(|:)(?P<cversion>[\d\.]+)\)?'
|
||||||
r'|- (?P<role>\w+\.\w+) \((?P<rversion>[\d\.]+)\))'
|
r'|- (?P<role>\w+\.\w+) \((?P<rversion>[\d\.]+)\))'
|
||||||
r' was installed successfully$')
|
r' was installed successfully$')
|
||||||
|
self.vars.set("new_collections", {}, change=True)
|
||||||
|
self.vars.set("new_roles", {}, change=True)
|
||||||
|
if self.vars.type != "collection":
|
||||||
|
self.vars.installed_roles = self._list_roles()
|
||||||
|
if self.vars.type != "roles":
|
||||||
|
self.vars.installed_collections = self._list_collections()
|
||||||
|
|
||||||
def _list_element(self, _type, path_re, elem_re):
|
def _list_element(self, _type, path_re, elem_re):
|
||||||
def process(rc, out, err):
|
def process(rc, out, err):
|
||||||
|
@ -322,24 +315,8 @@ class AnsibleGalaxyInstall(ModuleHelper):
|
||||||
def _list_roles(self):
|
def _list_roles(self):
|
||||||
return self._list_element('role', self._RE_LIST_PATH, self._RE_LIST_ROLE)
|
return self._list_element('role', self._RE_LIST_PATH, self._RE_LIST_ROLE)
|
||||||
|
|
||||||
def _setup29(self):
|
|
||||||
self.vars.set("new_collections", {})
|
|
||||||
self.vars.set("new_roles", {})
|
|
||||||
self.vars.set("ansible29_change", False, change=True, output=False)
|
|
||||||
if not (self.vars.ack_ansible29 or self.vars.ack_min_ansiblecore211):
|
|
||||||
self.warn("Ansible 2.9 or older: unable to retrieve lists of roles and collections already installed")
|
|
||||||
if self.vars.requirements_file is not None and self.vars.type == 'both':
|
|
||||||
self.warn("Ansible 2.9 or older: will install only roles from requirement files")
|
|
||||||
|
|
||||||
def _setup210plus(self):
|
|
||||||
self.vars.set("new_collections", {}, change=True)
|
|
||||||
self.vars.set("new_roles", {}, change=True)
|
|
||||||
if self.vars.type != "collection":
|
|
||||||
self.vars.installed_roles = self._list_roles()
|
|
||||||
if self.vars.type != "roles":
|
|
||||||
self.vars.installed_collections = self._list_collections()
|
|
||||||
|
|
||||||
def __run__(self):
|
def __run__(self):
|
||||||
|
|
||||||
def process(rc, out, err):
|
def process(rc, out, err):
|
||||||
for line in out.splitlines():
|
for line in out.splitlines():
|
||||||
match = self._RE_INSTALL_OUTPUT.match(line)
|
match = self._RE_INSTALL_OUTPUT.match(line)
|
||||||
|
@ -347,19 +324,9 @@ class AnsibleGalaxyInstall(ModuleHelper):
|
||||||
continue
|
continue
|
||||||
if match.group("collection"):
|
if match.group("collection"):
|
||||||
self.vars.new_collections[match.group("collection")] = match.group("cversion")
|
self.vars.new_collections[match.group("collection")] = match.group("cversion")
|
||||||
if self.is_ansible29:
|
|
||||||
self.vars.ansible29_change = True
|
|
||||||
elif match.group("role"):
|
elif match.group("role"):
|
||||||
self.vars.new_roles[match.group("role")] = match.group("rversion")
|
self.vars.new_roles[match.group("role")] = match.group("rversion")
|
||||||
if self.is_ansible29:
|
|
||||||
self.vars.ansible29_change = True
|
|
||||||
|
|
||||||
if self.is_ansible29:
|
|
||||||
if self.vars.type == 'both':
|
|
||||||
raise ValueError("Type 'both' not supported in Ansible 2.9")
|
|
||||||
self._setup29()
|
|
||||||
else:
|
|
||||||
self._setup210plus()
|
|
||||||
with self.runner("type galaxy_cmd force no_deps dest requirements_file name", output_process=process) as ctx:
|
with self.runner("type galaxy_cmd force no_deps dest requirements_file name", output_process=process) as ctx:
|
||||||
ctx.run(galaxy_cmd="install")
|
ctx.run(galaxy_cmd="install")
|
||||||
if self.verbosity > 2:
|
if self.verbosity > 2:
|
||||||
|
|
|
@ -104,6 +104,7 @@ options:
|
||||||
description:
|
description:
|
||||||
- The script/command that will be run periodically to check the health of the service.
|
- The script/command that will be run periodically to check the health of the service.
|
||||||
- Requires O(interval) to be provided.
|
- Requires O(interval) to be provided.
|
||||||
|
- Mutually exclusive with O(ttl), O(tcp) and O(http).
|
||||||
interval:
|
interval:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
|
@ -131,6 +132,7 @@ options:
|
||||||
Similar to the interval this is a number with a V(s) or V(m) suffix to
|
Similar to the interval this is a number with a V(s) or V(m) suffix to
|
||||||
signify the units of seconds or minutes, for example V(15s) or V(1m).
|
signify the units of seconds or minutes, for example V(15s) or V(1m).
|
||||||
If no suffix is supplied V(s) will be used by default, for example V(10) will be V(10s).
|
If no suffix is supplied V(s) will be used by default, for example V(10) will be V(10s).
|
||||||
|
- Mutually exclusive with O(script), O(tcp) and O(http).
|
||||||
tcp:
|
tcp:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
|
@ -138,6 +140,7 @@ options:
|
||||||
will check if the connection attempt to that port is successful (that is, the port is currently accepting connections).
|
will check if the connection attempt to that port is successful (that is, the port is currently accepting connections).
|
||||||
The format is V(host:port), for example V(localhost:80).
|
The format is V(host:port), for example V(localhost:80).
|
||||||
- Requires O(interval) to be provided.
|
- Requires O(interval) to be provided.
|
||||||
|
- Mutually exclusive with O(script), O(ttl) and O(http).
|
||||||
version_added: '1.3.0'
|
version_added: '1.3.0'
|
||||||
http:
|
http:
|
||||||
type: str
|
type: str
|
||||||
|
@ -145,6 +148,7 @@ options:
|
||||||
- Checks can be registered with an HTTP endpoint. This means that consul
|
- Checks can be registered with an HTTP endpoint. This means that consul
|
||||||
will check that the http endpoint returns a successful HTTP status.
|
will check that the http endpoint returns a successful HTTP status.
|
||||||
- Requires O(interval) to be provided.
|
- Requires O(interval) to be provided.
|
||||||
|
- Mutually exclusive with O(script), O(ttl) and O(tcp).
|
||||||
timeout:
|
timeout:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
|
@ -159,7 +163,7 @@ options:
|
||||||
ack_params_state_absent:
|
ack_params_state_absent:
|
||||||
type: bool
|
type: bool
|
||||||
description:
|
description:
|
||||||
- Disable deprecation warning when using parameters incompatible with O(state=absent).
|
- This parameter has no more effect and is deprecated. It will be removed in community.general 10.0.0.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
|
@ -377,13 +381,7 @@ def get_service_by_id_or_name(consul_api, service_id_or_name):
|
||||||
|
|
||||||
|
|
||||||
def parse_check(module):
|
def parse_check(module):
|
||||||
_checks = [module.params[p] for p in ('script', 'ttl', 'tcp', 'http') if module.params[p]]
|
if module.params['check_id'] or any(module.params[p] is not None for p in ('script', 'ttl', 'tcp', 'http')):
|
||||||
|
|
||||||
if len(_checks) > 1:
|
|
||||||
module.fail_json(
|
|
||||||
msg='checks are either script, tcp, http or ttl driven, supplying more than one does not make sense')
|
|
||||||
|
|
||||||
if module.params['check_id'] or _checks:
|
|
||||||
return ConsulCheck(
|
return ConsulCheck(
|
||||||
module.params['check_id'],
|
module.params['check_id'],
|
||||||
module.params['check_name'],
|
module.params['check_name'],
|
||||||
|
@ -501,15 +499,9 @@ class ConsulCheck(object):
|
||||||
self.check = consul.Check.ttl(self.ttl)
|
self.check = consul.Check.ttl(self.ttl)
|
||||||
|
|
||||||
if http:
|
if http:
|
||||||
if interval is None:
|
|
||||||
raise Exception('http check must specify interval')
|
|
||||||
|
|
||||||
self.check = consul.Check.http(http, self.interval, self.timeout)
|
self.check = consul.Check.http(http, self.interval, self.timeout)
|
||||||
|
|
||||||
if tcp:
|
if tcp:
|
||||||
if interval is None:
|
|
||||||
raise Exception('tcp check must specify interval')
|
|
||||||
|
|
||||||
regex = r"(?P<host>.*):(?P<port>(?:[0-9]+))$"
|
regex = r"(?P<host>.*):(?P<port>(?:[0-9]+))$"
|
||||||
match = re.match(regex, tcp)
|
match = re.match(regex, tcp)
|
||||||
|
|
||||||
|
@ -596,30 +588,33 @@ def main():
|
||||||
timeout=dict(type='str'),
|
timeout=dict(type='str'),
|
||||||
tags=dict(type='list', elements='str'),
|
tags=dict(type='list', elements='str'),
|
||||||
token=dict(no_log=True),
|
token=dict(no_log=True),
|
||||||
ack_params_state_absent=dict(type='bool'),
|
ack_params_state_absent=dict(
|
||||||
|
type='bool',
|
||||||
|
removed_in_version='10.0.0',
|
||||||
|
removed_from_collection='community.general',
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
mutually_exclusive=[
|
||||||
|
('script', 'ttl', 'tcp', 'http'),
|
||||||
|
],
|
||||||
required_if=[
|
required_if=[
|
||||||
('state', 'present', ['service_name']),
|
('state', 'present', ['service_name']),
|
||||||
('state', 'absent', ['service_id', 'service_name', 'check_id', 'check_name'], True),
|
('state', 'absent', ['service_id', 'service_name', 'check_id', 'check_name'], True),
|
||||||
],
|
],
|
||||||
|
required_by={
|
||||||
|
'script': 'interval',
|
||||||
|
'http': 'interval',
|
||||||
|
'tcp': 'interval',
|
||||||
|
},
|
||||||
supports_check_mode=False,
|
supports_check_mode=False,
|
||||||
)
|
)
|
||||||
p = module.params
|
p = module.params
|
||||||
|
|
||||||
test_dependencies(module)
|
test_dependencies(module)
|
||||||
if p['state'] == 'absent' and any(p[x] for x in ['script', 'ttl', 'tcp', 'http', 'interval']) and not p['ack_params_state_absent']:
|
if p['state'] == 'absent' and any(p[x] for x in ['script', 'ttl', 'tcp', 'http', 'interval']):
|
||||||
module.deprecate(
|
module.fail_json(
|
||||||
"The use of parameters 'script', 'ttl', 'tcp', 'http', 'interval' along with 'state=absent' is deprecated. "
|
msg="The use of parameters 'script', 'ttl', 'tcp', 'http', 'interval' along with 'state=absent' is no longer allowed."
|
||||||
"In community.general 8.0.0 their use will become an error. "
|
|
||||||
"To suppress this deprecation notice, set parameter ack_params_state_absent=true.",
|
|
||||||
version="8.0.0",
|
|
||||||
collection_name="community.general",
|
|
||||||
)
|
)
|
||||||
# When reaching c.g 8.0.0:
|
|
||||||
# - Replace the deprecation with a fail_json(), remove the "ack_params_state_absent" condition from the "if"
|
|
||||||
# - Add mutually_exclusive for ('script', 'ttl', 'tcp', 'http'), then remove that validation from parse_check()
|
|
||||||
# - Add required_by {'script': 'interval', 'http': 'interval', 'tcp': 'interval'}, then remove checks for 'interval' in ConsulCheck.__init__()
|
|
||||||
# - Deprecate the parameter ack_params_state_absent
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
register_with_consul(module)
|
register_with_consul(module)
|
||||||
|
|
|
@ -47,9 +47,8 @@ options:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- The action to take upon the key/value.
|
- The action to take upon the key/value.
|
||||||
- State V(get) is deprecated and will be removed in community.general 8.0.0. Please use the module M(community.general.gconftool2_info) instead.
|
|
||||||
required: true
|
required: true
|
||||||
choices: [ absent, get, present ]
|
choices: [ absent, present ]
|
||||||
config_source:
|
config_source:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
|
@ -114,7 +113,7 @@ class GConftool(StateModuleHelper):
|
||||||
key=dict(type='str', required=True, no_log=False),
|
key=dict(type='str', required=True, no_log=False),
|
||||||
value_type=dict(type='str', choices=['bool', 'float', 'int', 'string']),
|
value_type=dict(type='str', choices=['bool', 'float', 'int', 'string']),
|
||||||
value=dict(type='str'),
|
value=dict(type='str'),
|
||||||
state=dict(type='str', required=True, choices=['absent', 'get', 'present']),
|
state=dict(type='str', required=True, choices=['absent', 'present']),
|
||||||
direct=dict(type='bool', default=False),
|
direct=dict(type='bool', default=False),
|
||||||
config_source=dict(type='str'),
|
config_source=dict(type='str'),
|
||||||
),
|
),
|
||||||
|
@ -149,12 +148,6 @@ class GConftool(StateModuleHelper):
|
||||||
def _get(self):
|
def _get(self):
|
||||||
return self.runner("state key", output_process=self._make_process(False)).run(state="get")
|
return self.runner("state key", output_process=self._make_process(False)).run(state="get")
|
||||||
|
|
||||||
def state_get(self):
|
|
||||||
self.deprecate(
|
|
||||||
msg="State 'get' is deprecated. Please use the module community.general.gconftool2_info instead",
|
|
||||||
version="8.0.0", collection_name="community.general"
|
|
||||||
)
|
|
||||||
|
|
||||||
def state_absent(self):
|
def state_absent(self):
|
||||||
with self.runner("state key", output_process=self._make_process(False)) as ctx:
|
with self.runner("state key", output_process=self._make_process(False)) as ctx:
|
||||||
ctx.run()
|
ctx.run()
|
||||||
|
|
|
@ -103,9 +103,9 @@ options:
|
||||||
is only applied on updates.
|
is only applied on updates.
|
||||||
- If set to V(not_protected), runner can pick up jobs from both protected and unprotected branches.
|
- If set to V(not_protected), runner can pick up jobs from both protected and unprotected branches.
|
||||||
- If set to V(ref_protected), runner can pick up jobs only from protected branches.
|
- If set to V(ref_protected), runner can pick up jobs only from protected branches.
|
||||||
- The current default is V(ref_protected). This will change to no default in community.general 8.0.0.
|
- Before community.general 8.0.0 the default was V(ref_protected). This was changed to no default in community.general 8.0.0.
|
||||||
From that version on, if this option is not specified explicitly, GitLab will use V(not_protected)
|
If this option is not specified explicitly, GitLab will use V(not_protected) on creation, and the value set
|
||||||
on creation, and the value set will not be changed on any updates.
|
will not be changed on any updates.
|
||||||
required: false
|
required: false
|
||||||
choices: ["not_protected", "ref_protected"]
|
choices: ["not_protected", "ref_protected"]
|
||||||
type: str
|
type: str
|
||||||
|
@ -398,15 +398,6 @@ def main():
|
||||||
project = module.params['project']
|
project = module.params['project']
|
||||||
group = module.params['group']
|
group = module.params['group']
|
||||||
|
|
||||||
if access_level is None:
|
|
||||||
message = "The option 'access_level' is unspecified, so 'ref_protected' is assumed. "\
|
|
||||||
"In order to align the module with GitLab's runner API, this option will lose "\
|
|
||||||
"its default value in community.general 8.0.0. From that version on, you must set "\
|
|
||||||
"this option to 'ref_protected' explicitly, if you want to have a protected runner, "\
|
|
||||||
"otherwise GitLab's default access level gets applied, which is 'not_protected'"
|
|
||||||
module.deprecate(message, version='8.0.0', collection_name='community.general')
|
|
||||||
access_level = 'ref_protected'
|
|
||||||
|
|
||||||
gitlab_instance = gitlab_authentication(module)
|
gitlab_instance = gitlab_authentication(module)
|
||||||
gitlab_project = None
|
gitlab_project = None
|
||||||
gitlab_group = None
|
gitlab_group = None
|
||||||
|
|
|
@ -34,11 +34,7 @@ options:
|
||||||
description:
|
description:
|
||||||
- V(absent) - policy_profiles should not exist,
|
- V(absent) - policy_profiles should not exist,
|
||||||
- V(present) - policy_profiles should exist,
|
- V(present) - policy_profiles should exist,
|
||||||
- >
|
choices: ['absent', 'present']
|
||||||
V(list) - list current policy_profiles and policies.
|
|
||||||
This state is deprecated and will be removed 8.0.0.
|
|
||||||
Please use the module M(community.general.manageiq_policies_info) instead.
|
|
||||||
choices: ['absent', 'present', 'list']
|
|
||||||
default: 'present'
|
default: 'present'
|
||||||
policy_profiles:
|
policy_profiles:
|
||||||
type: list
|
type: list
|
||||||
|
@ -133,7 +129,7 @@ from ansible_collections.community.general.plugins.module_utils.manageiq import
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
actions = {'present': 'assign', 'absent': 'unassign', 'list': 'list'}
|
actions = {'present': 'assign', 'absent': 'unassign'}
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
policy_profiles=dict(type='list', elements='dict'),
|
policy_profiles=dict(type='list', elements='dict'),
|
||||||
resource_id=dict(type='int'),
|
resource_id=dict(type='int'),
|
||||||
|
@ -141,7 +137,7 @@ def main():
|
||||||
resource_type=dict(required=True, type='str',
|
resource_type=dict(required=True, type='str',
|
||||||
choices=list(manageiq_entities().keys())),
|
choices=list(manageiq_entities().keys())),
|
||||||
state=dict(required=False, type='str',
|
state=dict(required=False, type='str',
|
||||||
choices=['present', 'absent', 'list'], default='present'),
|
choices=['present', 'absent'], default='present'),
|
||||||
)
|
)
|
||||||
# add the manageiq connection arguments to the arguments
|
# add the manageiq connection arguments to the arguments
|
||||||
argument_spec.update(manageiq_argument_spec())
|
argument_spec.update(manageiq_argument_spec())
|
||||||
|
@ -162,13 +158,6 @@ def main():
|
||||||
resource_name = module.params['resource_name']
|
resource_name = module.params['resource_name']
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
|
|
||||||
if state == "list":
|
|
||||||
module.deprecate(
|
|
||||||
'The value "list" for "state" is deprecated. Please use community.general.manageiq_policies_info instead.',
|
|
||||||
version='8.0.0',
|
|
||||||
collection_name='community.general'
|
|
||||||
)
|
|
||||||
|
|
||||||
# get the action and resource type
|
# get the action and resource type
|
||||||
action = actions[state]
|
action = actions[state]
|
||||||
resource_type = manageiq_entities()[resource_type_key]
|
resource_type = manageiq_entities()[resource_type_key]
|
||||||
|
@ -176,11 +165,6 @@ def main():
|
||||||
manageiq = ManageIQ(module)
|
manageiq = ManageIQ(module)
|
||||||
manageiq_policies = manageiq.policies(resource_id, resource_type, resource_name)
|
manageiq_policies = manageiq.policies(resource_id, resource_type, resource_name)
|
||||||
|
|
||||||
if action == 'list':
|
|
||||||
# return a list of current profiles for this object
|
|
||||||
current_profiles = manageiq_policies.query_resource_profiles()
|
|
||||||
res_args = dict(changed=False, profiles=current_profiles)
|
|
||||||
else:
|
|
||||||
# assign or unassign the profiles
|
# assign or unassign the profiles
|
||||||
res_args = manageiq_policies.assign_or_unassign_profiles(policy_profiles, action)
|
res_args = manageiq_policies.assign_or_unassign_profiles(policy_profiles, action)
|
||||||
|
|
||||||
|
|
|
@ -34,11 +34,7 @@ options:
|
||||||
description:
|
description:
|
||||||
- V(absent) - tags should not exist.
|
- V(absent) - tags should not exist.
|
||||||
- V(present) - tags should exist.
|
- V(present) - tags should exist.
|
||||||
- >
|
choices: ['absent', 'present']
|
||||||
V(list) - list current tags.
|
|
||||||
This state is deprecated and will be removed 8.0.0.
|
|
||||||
Please use the module M(community.general.manageiq_tags_info) instead.
|
|
||||||
choices: ['absent', 'present', 'list']
|
|
||||||
default: 'present'
|
default: 'present'
|
||||||
tags:
|
tags:
|
||||||
type: list
|
type: list
|
||||||
|
@ -125,7 +121,7 @@ from ansible_collections.community.general.plugins.module_utils.manageiq import
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
actions = {'present': 'assign', 'absent': 'unassign', 'list': 'list'}
|
actions = {'present': 'assign', 'absent': 'unassign'}
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
tags=dict(type='list', elements='dict'),
|
tags=dict(type='list', elements='dict'),
|
||||||
resource_id=dict(type='int'),
|
resource_id=dict(type='int'),
|
||||||
|
@ -133,7 +129,7 @@ def main():
|
||||||
resource_type=dict(required=True, type='str',
|
resource_type=dict(required=True, type='str',
|
||||||
choices=list(manageiq_entities().keys())),
|
choices=list(manageiq_entities().keys())),
|
||||||
state=dict(required=False, type='str',
|
state=dict(required=False, type='str',
|
||||||
choices=['present', 'absent', 'list'], default='present'),
|
choices=['present', 'absent'], default='present'),
|
||||||
)
|
)
|
||||||
# add the manageiq connection arguments to the arguments
|
# add the manageiq connection arguments to the arguments
|
||||||
argument_spec.update(manageiq_argument_spec())
|
argument_spec.update(manageiq_argument_spec())
|
||||||
|
@ -154,13 +150,6 @@ def main():
|
||||||
resource_name = module.params['resource_name']
|
resource_name = module.params['resource_name']
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
|
|
||||||
if state == "list":
|
|
||||||
module.deprecate(
|
|
||||||
'The value "list" for "state" is deprecated. Please use community.general.manageiq_tags_info instead.',
|
|
||||||
version='8.0.0',
|
|
||||||
collection_name='community.general'
|
|
||||||
)
|
|
||||||
|
|
||||||
# get the action and resource type
|
# get the action and resource type
|
||||||
action = actions[state]
|
action = actions[state]
|
||||||
resource_type = manageiq_entities()[resource_type_key]
|
resource_type = manageiq_entities()[resource_type_key]
|
||||||
|
@ -173,11 +162,6 @@ def main():
|
||||||
|
|
||||||
manageiq_tags = ManageIQTags(manageiq, resource_type, resource_id)
|
manageiq_tags = ManageIQTags(manageiq, resource_type, resource_id)
|
||||||
|
|
||||||
if action == 'list':
|
|
||||||
# return a list of current tags for this object
|
|
||||||
current_tags = manageiq_tags.query_resource_tags()
|
|
||||||
res_args = dict(changed=False, tags=current_tags)
|
|
||||||
else:
|
|
||||||
# assign or unassign the tags
|
# assign or unassign the tags
|
||||||
res_args = manageiq_tags.assign_or_unassign_tags(tags, action)
|
res_args = manageiq_tags.assign_or_unassign_tags(tags, action)
|
||||||
|
|
||||||
|
|
|
@ -84,13 +84,6 @@ options:
|
||||||
default: false
|
default: false
|
||||||
aliases: ['array']
|
aliases: ['array']
|
||||||
version_added: 1.0.0
|
version_added: 1.0.0
|
||||||
disable_facts:
|
|
||||||
description:
|
|
||||||
- The value V(false) is no longer allowed since community.general 4.0.0.
|
|
||||||
- This option is deprecated, and will be removed in community.general 8.0.0.
|
|
||||||
type: bool
|
|
||||||
default: true
|
|
||||||
version_added: 2.1.0
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
|
@ -189,11 +182,6 @@ class XFConfProperty(StateModuleHelper):
|
||||||
choices=('string', 'int', 'double', 'bool', 'uint', 'uchar', 'char', 'uint64', 'int64', 'float')),
|
choices=('string', 'int', 'double', 'bool', 'uint', 'uchar', 'char', 'uint64', 'int64', 'float')),
|
||||||
value=dict(type='list', elements='raw'),
|
value=dict(type='list', elements='raw'),
|
||||||
force_array=dict(type='bool', default=False, aliases=['array']),
|
force_array=dict(type='bool', default=False, aliases=['array']),
|
||||||
disable_facts=dict(
|
|
||||||
type='bool', default=True,
|
|
||||||
removed_in_version='8.0.0',
|
|
||||||
removed_from_collection='community.general'
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
required_if=[('state', 'present', ['value', 'value_type'])],
|
required_if=[('state', 'present', ['value', 'value_type'])],
|
||||||
required_together=[('value', 'value_type')],
|
required_together=[('value', 'value_type')],
|
||||||
|
@ -210,9 +198,6 @@ class XFConfProperty(StateModuleHelper):
|
||||||
self.vars.set('type', self.vars.value_type)
|
self.vars.set('type', self.vars.value_type)
|
||||||
self.vars.meta('value').set(initial_value=self.vars.previous_value)
|
self.vars.meta('value').set(initial_value=self.vars.previous_value)
|
||||||
|
|
||||||
if self.vars.disable_facts is False:
|
|
||||||
self.do_raise('Returning results as facts has been removed. Stop using disable_facts=false.')
|
|
||||||
|
|
||||||
def process_command_output(self, rc, out, err):
|
def process_command_output(self, rc, out, err):
|
||||||
if err.rstrip() == self.does_not:
|
if err.rstrip() == self.does_not:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -7,15 +7,12 @@
|
||||||
plugins/modules/consul.py validate-modules:doc-missing-type
|
plugins/modules/consul.py validate-modules:doc-missing-type
|
||||||
plugins/modules/consul.py validate-modules:undocumented-parameter
|
plugins/modules/consul.py validate-modules:undocumented-parameter
|
||||||
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
||||||
plugins/modules/gconftool2.py validate-modules:parameter-state-invalid-choice # state=get - removed in 8.0.0
|
|
||||||
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
||||||
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
||||||
plugins/modules/manageiq_policies.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
|
|
||||||
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter # missing docs on suboptions
|
||||||
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/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
|
||||||
|
|
|
@ -2,15 +2,12 @@
|
||||||
plugins/modules/consul.py validate-modules:doc-missing-type
|
plugins/modules/consul.py validate-modules:doc-missing-type
|
||||||
plugins/modules/consul.py validate-modules:undocumented-parameter
|
plugins/modules/consul.py validate-modules:undocumented-parameter
|
||||||
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
||||||
plugins/modules/gconftool2.py validate-modules:parameter-state-invalid-choice # state=get - removed in 8.0.0
|
|
||||||
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
||||||
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
||||||
plugins/modules/manageiq_policies.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
|
|
||||||
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter # missing docs on suboptions
|
||||||
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/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
|
||||||
|
|
|
@ -4,15 +4,12 @@ plugins/lookup/etcd3.py validate-modules:invalid-documentation
|
||||||
plugins/modules/consul.py validate-modules:doc-missing-type
|
plugins/modules/consul.py validate-modules:doc-missing-type
|
||||||
plugins/modules/consul.py validate-modules:undocumented-parameter
|
plugins/modules/consul.py validate-modules:undocumented-parameter
|
||||||
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
||||||
plugins/modules/gconftool2.py validate-modules:parameter-state-invalid-choice # state=get - removed in 8.0.0
|
|
||||||
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
||||||
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
||||||
plugins/modules/manageiq_policies.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
|
|
||||||
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter # missing docs on suboptions
|
||||||
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/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
|
||||||
|
|
|
@ -4,16 +4,13 @@ plugins/lookup/etcd3.py validate-modules:invalid-documentation
|
||||||
plugins/modules/consul.py validate-modules:doc-missing-type
|
plugins/modules/consul.py validate-modules:doc-missing-type
|
||||||
plugins/modules/consul.py validate-modules:undocumented-parameter
|
plugins/modules/consul.py validate-modules:undocumented-parameter
|
||||||
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
||||||
plugins/modules/gconftool2.py validate-modules:parameter-state-invalid-choice # state=get - removed in 8.0.0
|
|
||||||
plugins/modules/homectl.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
plugins/modules/homectl.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
||||||
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
||||||
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
||||||
plugins/modules/manageiq_policies.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
|
|
||||||
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter # missing docs on suboptions
|
||||||
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/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
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
plugins/modules/consul.py validate-modules:doc-missing-type
|
plugins/modules/consul.py validate-modules:doc-missing-type
|
||||||
plugins/modules/consul.py validate-modules:undocumented-parameter
|
plugins/modules/consul.py validate-modules:undocumented-parameter
|
||||||
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
||||||
plugins/modules/gconftool2.py validate-modules:parameter-state-invalid-choice # state=get - removed in 8.0.0
|
|
||||||
plugins/modules/homectl.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
plugins/modules/homectl.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
||||||
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
||||||
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
||||||
plugins/modules/manageiq_policies.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
|
|
||||||
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter # missing docs on suboptions
|
||||||
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/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
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
plugins/modules/consul.py validate-modules:doc-missing-type
|
plugins/modules/consul.py validate-modules:doc-missing-type
|
||||||
plugins/modules/consul.py validate-modules:undocumented-parameter
|
plugins/modules/consul.py validate-modules:undocumented-parameter
|
||||||
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
||||||
plugins/modules/gconftool2.py validate-modules:parameter-state-invalid-choice # state=get - removed in 8.0.0
|
|
||||||
plugins/modules/homectl.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
plugins/modules/homectl.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
||||||
plugins/modules/homectl.py import-3.12 # Uses deprecated stdlib library 'crypt'
|
plugins/modules/homectl.py import-3.12 # Uses deprecated stdlib library 'crypt'
|
||||||
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
||||||
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
||||||
plugins/modules/manageiq_policies.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
|
|
||||||
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter # missing docs on suboptions
|
||||||
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/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
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
plugins/modules/consul.py validate-modules:doc-missing-type
|
plugins/modules/consul.py validate-modules:doc-missing-type
|
||||||
plugins/modules/consul.py validate-modules:undocumented-parameter
|
plugins/modules/consul.py validate-modules:undocumented-parameter
|
||||||
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
||||||
plugins/modules/gconftool2.py validate-modules:parameter-state-invalid-choice # state=get - removed in 8.0.0
|
|
||||||
plugins/modules/homectl.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
plugins/modules/homectl.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
||||||
plugins/modules/homectl.py import-3.12 # Uses deprecated stdlib library 'crypt'
|
plugins/modules/homectl.py import-3.12 # Uses deprecated stdlib library 'crypt'
|
||||||
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
||||||
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
||||||
plugins/modules/manageiq_policies.py validate-modules:parameter-state-invalid-choice # state=list - removed in 8.0.0
|
|
||||||
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:doc-choices-do-not-match-spec # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:doc-missing-type # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:parameter-type-not-in-doc # missing docs on suboptions
|
||||||
plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter # missing docs on suboptions
|
plugins/modules/manageiq_provider.py validate-modules:undocumented-parameter # missing docs on suboptions
|
||||||
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/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
|
||||||
|
|
|
@ -10,7 +10,7 @@ __metaclass__ = type
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.module_helper import (
|
from ansible_collections.community.general.plugins.module_utils.module_helper import (
|
||||||
ArgFormat, DependencyCtxMgr, VarMeta, VarDict, cause_changes
|
DependencyCtxMgr, VarMeta, VarDict, cause_changes
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,80 +18,6 @@ def single_lambda_2star(x, y, z):
|
||||||
return ["piggies=[{0},{1},{2}]".format(x, y, z)]
|
return ["piggies=[{0},{1},{2}]".format(x, y, z)]
|
||||||
|
|
||||||
|
|
||||||
ARG_FORMATS = dict(
|
|
||||||
simple_boolean_true=("--superflag", ArgFormat.BOOLEAN, 0,
|
|
||||||
True, ["--superflag"]),
|
|
||||||
simple_boolean_false=("--superflag", ArgFormat.BOOLEAN, 0,
|
|
||||||
False, []),
|
|
||||||
simple_boolean_none=("--superflag", ArgFormat.BOOLEAN, 0,
|
|
||||||
None, []),
|
|
||||||
simple_boolean_not_true=("--superflag", ArgFormat.BOOLEAN_NOT, 0,
|
|
||||||
True, []),
|
|
||||||
simple_boolean_not_false=("--superflag", ArgFormat.BOOLEAN_NOT, 0,
|
|
||||||
False, ["--superflag"]),
|
|
||||||
simple_boolean_not_none=("--superflag", ArgFormat.BOOLEAN_NOT, 0,
|
|
||||||
None, ["--superflag"]),
|
|
||||||
single_printf=("--param=%s", ArgFormat.PRINTF, 0,
|
|
||||||
"potatoes", ["--param=potatoes"]),
|
|
||||||
single_printf_no_substitution=("--param", ArgFormat.PRINTF, 0,
|
|
||||||
"potatoes", ["--param"]),
|
|
||||||
single_printf_none=("--param=%s", ArgFormat.PRINTF, 0,
|
|
||||||
None, []),
|
|
||||||
multiple_printf=(["--param", "free-%s"], ArgFormat.PRINTF, 0,
|
|
||||||
"potatoes", ["--param", "free-potatoes"]),
|
|
||||||
single_format=("--param={0}", ArgFormat.FORMAT, 0,
|
|
||||||
"potatoes", ["--param=potatoes"]),
|
|
||||||
single_format_none=("--param={0}", ArgFormat.FORMAT, 0,
|
|
||||||
None, []),
|
|
||||||
single_format_no_substitution=("--param", ArgFormat.FORMAT, 0,
|
|
||||||
"potatoes", ["--param"]),
|
|
||||||
multiple_format=(["--param", "free-{0}"], ArgFormat.FORMAT, 0,
|
|
||||||
"potatoes", ["--param", "free-potatoes"]),
|
|
||||||
multiple_format_none=(["--param", "free-{0}"], ArgFormat.FORMAT, 0,
|
|
||||||
None, []),
|
|
||||||
single_lambda_0star=((lambda v: ["piggies=[{0},{1},{2}]".format(v[0], v[1], v[2])]), None, 0,
|
|
||||||
['a', 'b', 'c'], ["piggies=[a,b,c]"]),
|
|
||||||
single_lambda_0star_none=((lambda v: ["piggies=[{0},{1},{2}]".format(v[0], v[1], v[2])]), None, 0,
|
|
||||||
None, []),
|
|
||||||
single_lambda_1star=((lambda a, b, c: ["piggies=[{0},{1},{2}]".format(a, b, c)]), None, 1,
|
|
||||||
['a', 'b', 'c'], ["piggies=[a,b,c]"]),
|
|
||||||
single_lambda_1star_none=((lambda a, b, c: ["piggies=[{0},{1},{2}]".format(a, b, c)]), None, 1,
|
|
||||||
None, []),
|
|
||||||
single_lambda_2star=(single_lambda_2star, None, 2,
|
|
||||||
dict(z='c', x='a', y='b'), ["piggies=[a,b,c]"]),
|
|
||||||
single_lambda_2star_none=(single_lambda_2star, None, 2,
|
|
||||||
None, []),
|
|
||||||
)
|
|
||||||
ARG_FORMATS_IDS = sorted(ARG_FORMATS.keys())
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('fmt, style, stars, value, expected',
|
|
||||||
(ARG_FORMATS[tc] for tc in ARG_FORMATS_IDS),
|
|
||||||
ids=ARG_FORMATS_IDS)
|
|
||||||
def test_arg_format(fmt, style, stars, value, expected):
|
|
||||||
af = ArgFormat('name', fmt, style, stars)
|
|
||||||
actual = af.to_text(value)
|
|
||||||
print("formatted string = {0}".format(actual))
|
|
||||||
assert actual == expected, "actual = {0}".format(actual)
|
|
||||||
|
|
||||||
|
|
||||||
ARG_FORMATS_FAIL = dict(
|
|
||||||
int_fmt=(3, None, 0, "", [""]),
|
|
||||||
bool_fmt=(True, None, 0, "", [""]),
|
|
||||||
)
|
|
||||||
ARG_FORMATS_FAIL_IDS = sorted(ARG_FORMATS_FAIL.keys())
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('fmt, style, stars, value, expected',
|
|
||||||
(ARG_FORMATS_FAIL[tc] for tc in ARG_FORMATS_FAIL_IDS),
|
|
||||||
ids=ARG_FORMATS_FAIL_IDS)
|
|
||||||
def test_arg_format_fail(fmt, style, stars, value, expected):
|
|
||||||
with pytest.raises(TypeError):
|
|
||||||
af = ArgFormat('name', fmt, style, stars)
|
|
||||||
actual = af.to_text(value)
|
|
||||||
print("formatted string = {0}".format(actual))
|
|
||||||
|
|
||||||
|
|
||||||
def test_dependency_ctxmgr():
|
def test_dependency_ctxmgr():
|
||||||
ctx = DependencyCtxMgr("POTATOES", "Potatoes must be installed")
|
ctx = DependencyCtxMgr("POTATOES", "Potatoes must be installed")
|
||||||
with ctx:
|
with ctx:
|
||||||
|
|
|
@ -4,28 +4,6 @@
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
---
|
---
|
||||||
- id: test_simple_element_get
|
|
||||||
input:
|
|
||||||
state: get
|
|
||||||
key: /desktop/gnome/background/picture_filename
|
|
||||||
output: {}
|
|
||||||
run_command_calls:
|
|
||||||
- command: [/testbin/gconftool-2, --get, /desktop/gnome/background/picture_filename]
|
|
||||||
environ: &env-def {environ_update: {LANGUAGE: C, LC_ALL: C}, check_rc: true}
|
|
||||||
rc: 0
|
|
||||||
out: "100\n"
|
|
||||||
err: ""
|
|
||||||
- id: test_simple_element_get_not_found
|
|
||||||
input:
|
|
||||||
state: get
|
|
||||||
key: /desktop/gnome/background/picture_filename
|
|
||||||
output: {}
|
|
||||||
run_command_calls:
|
|
||||||
- command: [/testbin/gconftool-2, --get, /desktop/gnome/background/picture_filename]
|
|
||||||
environ: *env-def
|
|
||||||
rc: 0
|
|
||||||
out: ""
|
|
||||||
err: "No value set for `/desktop/gnome/background/picture_filename'\n"
|
|
||||||
- id: test_simple_element_set
|
- id: test_simple_element_set
|
||||||
input:
|
input:
|
||||||
state: present
|
state: present
|
||||||
|
@ -37,7 +15,7 @@
|
||||||
changed: true
|
changed: true
|
||||||
run_command_calls:
|
run_command_calls:
|
||||||
- command: [/testbin/gconftool-2, --get, /desktop/gnome/background/picture_filename]
|
- command: [/testbin/gconftool-2, --get, /desktop/gnome/background/picture_filename]
|
||||||
environ: *env-def
|
environ: &env-def {environ_update: {LANGUAGE: C, LC_ALL: C}, check_rc: true}
|
||||||
rc: 0
|
rc: 0
|
||||||
out: "100\n"
|
out: "100\n"
|
||||||
err: ""
|
err: ""
|
||||||
|
|
Loading…
Reference in a new issue