opkg: deprecate value "" for force (#9172)

* opkg: deprecate value "" for force

* fix sanity plus wording

* add comments for future removal

* add changelog frag
pull/9223/head
Alexei Znamensky 2024-12-03 08:19:36 +13:00 committed by GitHub
parent 34010a788a
commit d826dd1c88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View File

@ -0,0 +1,2 @@
deprecated_features:
- opkg - deprecate value ``""`` for parameter ``force`` (https://github.com/ansible-collections/community.general/pull/9172).

View File

@ -46,8 +46,7 @@ options:
force: force:
description: description:
- The C(opkg --force) parameter used. - The C(opkg --force) parameter used.
- Passing V("") as value and not passing any value at all have both - State V("") is deprecated and will be removed in community.general 12.0.0. Please omit the parameter O(force) to obtain the same behavior.
the same effect of B(not) using any C(--force-) parameter.
choices: choices:
- "" - ""
- "depends" - "depends"
@ -152,7 +151,11 @@ class Opkg(StateModuleHelper):
) )
def _force(value): def _force(value):
# 12.0.0 function _force() to be removed entirely
if value == "": if value == "":
self.deprecate('Value "" is deprecated. Simply omit the parameter "force" to prevent any --force-X argument when running opkg',
version="12.0.0",
collection_name="community.general")
value = None value = None
return cmd_runner_fmt.as_optval("--force-")(value, ctx_ignore_none=True) return cmd_runner_fmt.as_optval("--force-")(value, ctx_ignore_none=True)
@ -164,7 +167,7 @@ class Opkg(StateModuleHelper):
arg_formats=dict( arg_formats=dict(
package=cmd_runner_fmt.as_list(), package=cmd_runner_fmt.as_list(),
state=cmd_runner_fmt.as_map(state_map), state=cmd_runner_fmt.as_map(state_map),
force=cmd_runner_fmt.as_func(_force), force=cmd_runner_fmt.as_func(_force), # 12.0.0 replace with cmd_runner_fmt.as_optval("--force-")
update_cache=cmd_runner_fmt.as_bool("update"), update_cache=cmd_runner_fmt.as_bool("update"),
version=cmd_runner_fmt.as_fixed("--version"), version=cmd_runner_fmt.as_fixed("--version"),
), ),