1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

cpanm: deprecate default mode (#6512)

* cpanm: deprecate default mode

* add changelog frag
This commit is contained in:
Alexei Znamensky 2023-05-30 04:52:02 +12:00 committed by GitHub
parent ee47497e97
commit 64f74e1228
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -0,0 +1,2 @@
deprecated_features:
- cpanm - value ``compatibility`` is deprecated as default for parameter ``mode`` (https://github.com/ansible-collections/community.general/pull/6512).

View file

@ -68,9 +68,9 @@ options:
mode: mode:
description: description:
- Controls the module behavior. See notes below for more details. - Controls the module behavior. See notes below for more details.
- Default is C(compatibility) but that behavior is deprecated and will be changed to C(new) in community.general 9.0.0.
type: str type: str
choices: [compatibility, new] choices: [compatibility, new]
default: compatibility
version_added: 3.0.0 version_added: 3.0.0
name_check: name_check:
description: description:
@ -158,7 +158,7 @@ class CPANMinus(ModuleHelper):
mirror_only=dict(type='bool', default=False), mirror_only=dict(type='bool', default=False),
installdeps=dict(type='bool', default=False), installdeps=dict(type='bool', default=False),
executable=dict(type='path'), executable=dict(type='path'),
mode=dict(type='str', choices=['compatibility', 'new'], default='compatibility'), mode=dict(type='str', choices=['compatibility', 'new']),
name_check=dict(type='str') name_check=dict(type='str')
), ),
required_one_of=[('name', 'from_path')], required_one_of=[('name', 'from_path')],
@ -176,6 +176,14 @@ class CPANMinus(ModuleHelper):
def __init_module__(self): def __init_module__(self):
v = self.vars v = self.vars
if v.mode is None:
self.deprecate(
"The default value 'compatibility' for parameter 'mode' is being deprecated "
"and it will be replaced by 'new'",
version="9.0.0",
collection_name="community.general"
)
v.mode = "compatibility"
if v.mode == "compatibility": if v.mode == "compatibility":
if v.name_check: if v.name_check:
self.do_raise("Parameter name_check can only be used with mode=new") self.do_raise("Parameter name_check can only be used with mode=new")