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:
Felix Fontein 2023-10-09 13:31:27 +02:00 committed by GitHub
parent c7084c6c30
commit 40809ed953
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 88 additions and 514 deletions

View file

@ -104,6 +104,7 @@ options:
description:
- The script/command that will be run periodically to check the health of the service.
- Requires O(interval) to be provided.
- Mutually exclusive with O(ttl), O(tcp) and O(http).
interval:
type: str
description:
@ -131,6 +132,7 @@ options:
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).
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:
type: str
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).
The format is V(host:port), for example V(localhost:80).
- Requires O(interval) to be provided.
- Mutually exclusive with O(script), O(ttl) and O(http).
version_added: '1.3.0'
http:
type: str
@ -145,6 +148,7 @@ options:
- Checks can be registered with an HTTP endpoint. This means that consul
will check that the http endpoint returns a successful HTTP status.
- Requires O(interval) to be provided.
- Mutually exclusive with O(script), O(ttl) and O(tcp).
timeout:
type: str
description:
@ -159,7 +163,7 @@ options:
ack_params_state_absent:
type: bool
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 = '''
@ -377,13 +381,7 @@ def get_service_by_id_or_name(consul_api, service_id_or_name):
def parse_check(module):
_checks = [module.params[p] for p in ('script', 'ttl', 'tcp', 'http') if module.params[p]]
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:
if module.params['check_id'] or any(module.params[p] is not None for p in ('script', 'ttl', 'tcp', 'http')):
return ConsulCheck(
module.params['check_id'],
module.params['check_name'],
@ -501,15 +499,9 @@ class ConsulCheck(object):
self.check = consul.Check.ttl(self.ttl)
if http:
if interval is None:
raise Exception('http check must specify interval')
self.check = consul.Check.http(http, self.interval, self.timeout)
if tcp:
if interval is None:
raise Exception('tcp check must specify interval')
regex = r"(?P<host>.*):(?P<port>(?:[0-9]+))$"
match = re.match(regex, tcp)
@ -596,30 +588,33 @@ def main():
timeout=dict(type='str'),
tags=dict(type='list', elements='str'),
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=[
('state', 'present', ['service_name']),
('state', 'absent', ['service_id', 'service_name', 'check_id', 'check_name'], True),
],
required_by={
'script': 'interval',
'http': 'interval',
'tcp': 'interval',
},
supports_check_mode=False,
)
p = module.params
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']:
module.deprecate(
"The use of parameters 'script', 'ttl', 'tcp', 'http', 'interval' along with 'state=absent' is deprecated. "
"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",
if p['state'] == 'absent' and any(p[x] for x in ['script', 'ttl', 'tcp', 'http', 'interval']):
module.fail_json(
msg="The use of parameters 'script', 'ttl', 'tcp', 'http', 'interval' along with 'state=absent' is no longer allowed."
)
# 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:
register_with_consul(module)