mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
rhsm_repository: deprecate "state=present" and "state=absent" (#6673)
"state=present" is broken, and acts like "disabled"; also, the subscription repositories cannot be really "added" or "removed", which is what "present" and "absent" would imply, but only enabled or disabled. Hence, deprecate both these states, slating them for removal in community.general 10.0.0.
This commit is contained in:
parent
74ffb29573
commit
2dbe529a90
2 changed files with 20 additions and 0 deletions
|
@ -0,0 +1,8 @@
|
||||||
|
deprecated_features:
|
||||||
|
- |
|
||||||
|
rhsm_repository - ``state=present`` has not been working as expected for many years,
|
||||||
|
and it seems it was not noticed so far; also, "presence" is not really a valid concept
|
||||||
|
for subscription repositories, which can only be enabled or disabled. Hence, mark the
|
||||||
|
``present`` and ``absent`` values of the ``state`` option as deprecated, slating them
|
||||||
|
for removal in community.general 10.0.0
|
||||||
|
(https://github.com/ansible-collections/community.general/pull/6673).
|
|
@ -36,6 +36,10 @@ options:
|
||||||
description:
|
description:
|
||||||
- If state is equal to present or disabled, indicates the desired
|
- If state is equal to present or disabled, indicates the desired
|
||||||
repository state.
|
repository state.
|
||||||
|
- |
|
||||||
|
Please note that V(present) and V(absent) are deprecated, and will be
|
||||||
|
removed in community.general 10.0.0; please use V(enabled) and
|
||||||
|
V(disabled) instead.
|
||||||
choices: [present, enabled, absent, disabled]
|
choices: [present, enabled, absent, disabled]
|
||||||
default: "enabled"
|
default: "enabled"
|
||||||
type: str
|
type: str
|
||||||
|
@ -253,6 +257,14 @@ def main():
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
purge = module.params['purge']
|
purge = module.params['purge']
|
||||||
|
|
||||||
|
if state in ['present', 'absent']:
|
||||||
|
replacement = 'enabled' if state == 'present' else 'disabled'
|
||||||
|
module.deprecate(
|
||||||
|
'state=%s is deprecated; please use state=%s instead' % (state, replacement),
|
||||||
|
version='10.0.0',
|
||||||
|
collection_name='community.general',
|
||||||
|
)
|
||||||
|
|
||||||
repository_modify(module, state, name, purge)
|
repository_modify(module, state, name, purge)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue