Skip to content

Commit c72a106

Browse files
russozpatchback[bot]
authored andcommitted
opkg: deprecate value "" for force (#9172)
* opkg: deprecate value "" for force * fix sanity plus wording * add comments for future removal * add changelog frag (cherry picked from commit d826dd1)
1 parent 09f99e6 commit c72a106

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
deprecated_features:
2+
- opkg - deprecate value ``""`` for parameter ``force`` (https://github.com/ansible-collections/community.general/pull/9172).

plugins/modules/opkg.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@
4646
force:
4747
description:
4848
- The C(opkg --force) parameter used.
49-
- Passing V("") as value and not passing any value at all have both
50-
the same effect of B(not) using any C(--force-) parameter.
49+
- 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.
5150
choices:
5251
- ""
5352
- "depends"
@@ -152,7 +151,11 @@ def __init_module__(self):
152151
)
153152

154153
def _force(value):
154+
# 12.0.0 function _force() to be removed entirely
155155
if value == "":
156+
self.deprecate('Value "" is deprecated. Simply omit the parameter "force" to prevent any --force-X argument when running opkg',
157+
version="12.0.0",
158+
collection_name="community.general")
156159
value = None
157160
return cmd_runner_fmt.as_optval("--force-")(value, ctx_ignore_none=True)
158161

@@ -164,7 +167,7 @@ def _force(value):
164167
arg_formats=dict(
165168
package=cmd_runner_fmt.as_list(),
166169
state=cmd_runner_fmt.as_map(state_map),
167-
force=cmd_runner_fmt.as_func(_force),
170+
force=cmd_runner_fmt.as_func(_force), # 12.0.0 replace with cmd_runner_fmt.as_optval("--force-")
168171
update_cache=cmd_runner_fmt.as_bool("update"),
169172
version=cmd_runner_fmt.as_fixed("--version"),
170173
),

0 commit comments

Comments
 (0)