Skip to content

Commit

Permalink
opkg: deprecate value "" for force (#9172)
Browse files Browse the repository at this point in the history
* opkg: deprecate value "" for force

* fix sanity plus wording

* add comments for future removal

* add changelog frag
  • Loading branch information
russoz authored Dec 2, 2024
1 parent 34010a7 commit d826dd1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/9172-opkg-deprecate-force-none.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deprecated_features:
- opkg - deprecate value ``""`` for parameter ``force`` (https://github.com/ansible-collections/community.general/pull/9172).
9 changes: 6 additions & 3 deletions plugins/modules/opkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
force:
description:
- The C(opkg --force) parameter used.
- Passing V("") as value and not passing any value at all have both
the same effect of B(not) using any C(--force-) parameter.
- 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.
choices:
- ""
- "depends"
Expand Down Expand Up @@ -152,7 +151,11 @@ def __init_module__(self):
)

def _force(value):
# 12.0.0 function _force() to be removed entirely
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
return cmd_runner_fmt.as_optval("--force-")(value, ctx_ignore_none=True)

Expand All @@ -164,7 +167,7 @@ def _force(value):
arg_formats=dict(
package=cmd_runner_fmt.as_list(),
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"),
version=cmd_runner_fmt.as_fixed("--version"),
),
Expand Down

0 comments on commit d826dd1

Please sign in to comment.