Remove deprecated features, bump version to 6.0.0 (#5326)

* Bump version to 6.0.0.

* sender option is now required.

* Default of want_proxmox_nodes_ansible_host changed from true to false.

* username is now an alias of user, and no longer of workspace.

* Remove deprecated return values in favor of end_state.

* Remove debug option.

* Change default of ignore_volatile_options from true to false.

* gitlab_group must now always contain the full path.

* Change default of norc from false to ture.

* Remove deprecated property.

* Add PR URL.

* Adjust bitbucket unit tests.

* Adjust module_helper integration test.
This commit is contained in:
Felix Fontein 2022-10-25 08:07:21 +02:00 committed by GitHub
parent 091bdc77c3
commit 2830a3452d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 70 additions and 243 deletions

View file

@ -49,8 +49,9 @@ options:
sender:
description:
- Mail sender.
- Note that this will be required from community.general 6.0.0 on.
- This is required since community.general 6.0.0.
type: str
required: true
ini:
- section: callback_mail
key: sender
@ -105,10 +106,6 @@ class CallbackModule(CallbackBase):
super(CallbackModule, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct)
self.sender = self.get_option('sender')
if self.sender is None:
self._display.deprecated(
'The sender for the mail callback has not been specified. This will be an error in the future',
version='6.0.0', collection_name='community.general')
self.to = self.get_option('to')
self.smtphost = self.get_option('mta')
self.smtpport = self.get_option('mtaport')

View file

@ -27,8 +27,10 @@ options:
description:
- The username.
- If not set the environment variable C(BITBUCKET_USERNAME) will be used.
- I(username) is an alias of I(user) since community.genreal 6.0.0. It was an alias of I(workspace) before.
type: str
version_added: 4.0.0
aliases: [ username ]
password:
description:
- The App password.

View file

@ -113,10 +113,9 @@ DOCUMENTATION = '''
description:
- Whether to set C(ansbile_host) for proxmox nodes.
- When set to C(true) (default), will use the first available interface. This can be different from what you expect.
- This currently defaults to C(true), but the default is deprecated since community.general 4.8.0.
The default will change to C(false) in community.general 6.0.0. To avoid a deprecation warning, please
set this parameter explicitly.
- The default of this option changed from C(true) to C(false) in community.general 6.0.0.
type: bool
default: false
filters:
version_added: 4.6.0
description: A list of Jinja templates that allow filtering hosts.
@ -567,14 +566,6 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
self.inventory.add_group(nodes_group)
want_proxmox_nodes_ansible_host = self.get_option("want_proxmox_nodes_ansible_host")
if want_proxmox_nodes_ansible_host is None:
display.deprecated(
'The want_proxmox_nodes_ansible_host option of the community.general.proxmox inventory plugin'
' currently defaults to `true`, but this default has been deprecated and will change to `false`'
' in community.general 6.0.0. To keep the current behavior and remove this deprecation warning,'
' explicitly set `want_proxmox_nodes_ansible_host` to `true` in your inventory configuration',
version='6.0.0', collection_name='community.general')
want_proxmox_nodes_ansible_host = True
# gather vm's on nodes
self._get_auth()

View file

@ -13,7 +13,7 @@ from ansible_collections.community.general.plugins.module_utils.mh.base import M
from ansible_collections.community.general.plugins.module_utils.mh.mixins.cmd import CmdMixin
from ansible_collections.community.general.plugins.module_utils.mh.mixins.state import StateMixin
from ansible_collections.community.general.plugins.module_utils.mh.mixins.deps import DependencyMixin
from ansible_collections.community.general.plugins.module_utils.mh.mixins.vars import VarsMixin, VarDict as _VD
from ansible_collections.community.general.plugins.module_utils.mh.mixins.vars import VarsMixin
from ansible_collections.community.general.plugins.module_utils.mh.mixins.deprecate_attrs import DeprecateAttrsMixin
@ -25,8 +25,6 @@ class ModuleHelper(DeprecateAttrsMixin, VarsMixin, DependencyMixin, ModuleHelper
change_params = ()
facts_params = ()
VarDict = _VD # for backward compatibility, will be deprecated at some point
def __init__(self, module=None):
super(ModuleHelper, self).__init__(module)
for name, value in self.module.params.items():
@ -38,16 +36,6 @@ class ModuleHelper(DeprecateAttrsMixin, VarsMixin, DependencyMixin, ModuleHelper
fact=name in self.facts_params,
)
self._deprecate_attr(
attr="VarDict",
msg="ModuleHelper.VarDict attribute is deprecated, use VarDict from "
"the ansible_collections.community.general.plugins.module_utils.mh.mixins.vars module instead",
version="6.0.0",
collection_name="community.general",
target=ModuleHelper,
module=self.module,
)
def update_output(self, **kwargs):
self.update_vars(meta={"output": True}, **kwargs)

View file

@ -28,7 +28,7 @@ class BitbucketHelper:
# TODO:
# - Rename user to username once current usage of username is removed
# - Alias user to username and deprecate it
user=dict(type='str', fallback=(env_fallback, ['BITBUCKET_USERNAME'])),
user=dict(type='str', aliases=['username'], fallback=(env_fallback, ['BITBUCKET_USERNAME'])),
password=dict(type='str', no_log=True, fallback=(env_fallback, ['BITBUCKET_PASSWORD'])),
)

View file

@ -50,10 +50,10 @@ options:
- If set to C(true), options starting with C(volatile.) are ignored. As a result,
they are reapplied for each execution.
- This default behavior can be changed by setting this option to C(false).
- The current default value C(true) is deprecated since community.general 4.0.0,
and will change to C(false) in community.general 6.0.0.
- The default value changed from C(true) to C(false) in community.general 6.0.0.
type: bool
required: false
default: false
version_added: 3.7.0
profiles:
description:
@ -769,6 +769,7 @@ def main():
),
ignore_volatile_options=dict(
type='bool',
default=False,
),
devices=dict(
type='dict',
@ -832,16 +833,6 @@ def main():
supports_check_mode=False,
)
if module.params['ignore_volatile_options'] is None:
module.params['ignore_volatile_options'] = True
module.deprecate(
'If the keyword "volatile" is used in a playbook in the config'
'section, a "changed" message will appear with every run, even without a change'
'to the playbook.'
'This will change in the future. Please test your scripts'
'by "ignore_volatile_options: false". To keep the old behavior, set that option explicitly to "true"',
version='6.0.0', collection_name='community.general')
lxd_manage = LXDContainerManagement(module=module)
lxd_manage.run()

View file

@ -552,7 +552,7 @@ def create_payload(module, uuid):
# Create the JSON payload (vmdef) and return the filename.
# Filter out the few options that are not valid VM properties.
module_options = ['debug', 'force', 'state']
module_options = ['force', 'state']
# @TODO make this a simple {} comprehension as soon as py2 is ditched
# @TODO {k: v for k, v in p.items() if k not in module_options}
vmdef = dict([(k, v) for k, v in module.params.items() if k not in module_options and v])
@ -689,7 +689,6 @@ def main():
nics=dict(type='list', elements='dict'),
resolvers=dict(type='list', elements='str'),
filesystems=dict(type='list', elements='dict'),
debug=dict(type='bool', removed_in_version='6.0.0', removed_from_collection='community.general'),
)
# Add our 'simple' options to options dict.

View file

@ -173,39 +173,6 @@ msg:
returned: always
type: str
flow:
description:
- JSON representation for the authentication.
- Deprecated return value, it will be removed in community.general 6.0.0. Please use the return value I(end_state) instead.
returned: on success
type: dict
sample: {
"alias": "Copy of first broker login",
"authenticationExecutions": [
{
"alias": "review profile config",
"authenticationConfig": {
"alias": "review profile config",
"config": { "update.profile.on.first.login": "missing" },
"id": "6f09e4fb-aad4-496a-b873-7fa9779df6d7"
},
"configurable": true,
"displayName": "Review Profile",
"id": "8f77dab8-2008-416f-989e-88b09ccf0b4c",
"index": 0,
"level": 0,
"providerId": "idp-review-profile",
"requirement": "REQUIRED",
"requirementChoices": [ "REQUIRED", "ALTERNATIVE", "DISABLED" ]
}
],
"builtIn": false,
"description": "Actions taken after first broker login with identity provider account, which is not yet linked to any Keycloak account",
"id": "bc228863-5887-4297-b898-4d988f8eaa5c",
"providerId": "basic-flow",
"topLevel": true
}
end_state:
description: Representation of the authentication after module execution.
returned: on success
@ -407,7 +374,6 @@ def main():
result['diff'] = dict(before='', after='')
result['changed'] = False
result['end_state'] = {}
result['flow'] = result['end_state']
result['msg'] = new_auth_repr["alias"] + ' absent'
module.exit_json(**result)
@ -440,7 +406,6 @@ def main():
if exec_repr is not None:
auth_repr["authenticationExecutions"] = exec_repr
result['end_state'] = auth_repr
result['flow'] = result['end_state']
else:
if state == 'present':
@ -478,7 +443,6 @@ def main():
if exec_repr is not None:
auth_repr["authenticationExecutions"] = exec_repr
result['end_state'] = auth_repr
result['flow'] = result['end_state']
else:
# Process a deletion (because state was not 'present')

View file

@ -214,59 +214,6 @@ end_state:
manage: true
manageMembership: true
view: true
group:
description:
- Representation of the group after module execution.
- Deprecated return value, it will be removed in community.general 6.0.0. Please use the return value I(end_state) instead.
returned: always
type: complex
contains:
id:
description: GUID that identifies the group.
type: str
returned: always
sample: 23f38145-3195-462c-97e7-97041ccea73e
name:
description: Name of the group.
type: str
returned: always
sample: grp-test-123
attributes:
description: Attributes applied to this group.
type: dict
returned: always
sample:
attr1: ["val1", "val2", "val3"]
path:
description: URI path to the group.
type: str
returned: always
sample: /grp-test-123
realmRoles:
description: An array of the realm-level roles granted to this group.
type: list
returned: always
sample: []
subGroups:
description: A list of groups that are children of this group. These groups will have the same parameters as
documented here.
type: list
returned: always
clientRoles:
description: A list of client-level roles granted to this group.
type: list
returned: always
sample: []
access:
description: A dict describing the accesses you have to this group based on the credentials used.
type: dict
returned: always
sample:
manage: true
manageMembership: true
view: true
'''
from ansible_collections.community.general.plugins.module_utils.identity.keycloak.keycloak import KeycloakAPI, camel, \
@ -356,7 +303,6 @@ def main():
result['diff'] = dict(before='', after='')
result['changed'] = False
result['end_state'] = {}
result['group'] = result['end_state']
result['msg'] = 'Group does not exist; doing nothing.'
module.exit_json(**result)
@ -377,7 +323,6 @@ def main():
after_group = kc.get_group_by_name(name, realm)
result['end_state'] = after_group
result['group'] = result['end_state']
result['msg'] = 'Group {name} has been created with ID {id}'.format(name=after_group['name'],
id=after_group['id'])
@ -391,7 +336,6 @@ def main():
if desired_group == before_group:
result['changed'] = False
result['end_state'] = desired_group
result['group'] = result['end_state']
result['msg'] = "No changes required to group {name}.".format(name=before_group['name'])
module.exit_json(**result)
@ -410,7 +354,6 @@ def main():
after_group = kc.get_group_by_groupid(desired_group['id'], realm=realm)
result['end_state'] = after_group
result['group'] = result['end_state']
result['msg'] = "Group {id} has been updated".format(id=after_group['id'])
module.exit_json(**result)
@ -430,7 +373,6 @@ def main():
kc.delete_group(groupid=gid, realm=realm)
result['end_state'] = {}
result['group'] = result['end_state']
result['msg'] = "Group {name} has been deleted".format(name=before_group['name'])

View file

@ -70,11 +70,10 @@ options:
version_added: 3.3.0
norc:
type: bool
default: true
description:
- Avoid loading any C(.gemrc) file. Ignored for RubyGems prior to 2.5.2.
- The current default value C(false) has been deprecated in community.general 5.0.0.
Explicitly specify the value to prevent the deprecation warning to be shown."
- From community.general 6.0.0 on, the default will be changed to C(true).
- The default changed from C(false) to C(true) in community.general 6.0.0.
version_added: 3.3.0
env_shebang:
description:
@ -298,7 +297,7 @@ def main():
user_install=dict(required=False, default=True, type='bool'),
install_dir=dict(required=False, type='path'),
bindir=dict(type='path'),
norc=dict(type='bool'),
norc=dict(type='bool', default=True),
pre_release=dict(required=False, default=False, type='bool'),
include_doc=dict(required=False, default=False, type='bool'),
env_shebang=dict(required=False, default=False, type='bool'),
@ -316,12 +315,6 @@ def main():
module.fail_json(msg="Cannot maintain state=latest when installing from local source")
if module.params['user_install'] and module.params['install_dir']:
module.fail_json(msg="install_dir requires user_install=false")
if module.params['norc'] is None:
module.deprecate(
'The default of the norc option has been deprecated. It will be changed to `true`'
' in community.general 6.0.0. Specify an explicit value to get rid of this message',
version='6.0.0', collection_name='community.general')
module.params['norc'] = False
if not module.params['gem_source']:
module.params['gem_source'] = module.params['name']

View file

@ -27,10 +27,9 @@ options:
workspace:
description:
- The repository owner.
- Alias I(username) has been deprecated and will become an alias of I(user) in community.general 6.0.0.
- I(username) used to be an alias of this option. Since community.general 6.0.0 it is an alias of I(user).
type: str
required: true
aliases: [ username ]
key:
description:
- The SSH public key.
@ -218,8 +217,7 @@ def main():
argument_spec.update(
repository=dict(type='str', required=True),
workspace=dict(
type='str', aliases=['username'], required=True,
deprecated_aliases=[dict(name='username', version='6.0.0', collection_name='community.general')],
type='str', required=True,
),
key=dict(type='str', no_log=False),
label=dict(type='str', required=True),

View file

@ -27,10 +27,9 @@ options:
workspace:
description:
- The repository owner.
- Alias I(username) has been deprecated and will become an alias of I(user) in community.general 6.0.0.
- I(username) used to be an alias of this option. Since community.general 6.0.0 it is an alias of I(user).
type: str
required: true
aliases: [ username ]
public_key:
description:
- The public key.
@ -154,10 +153,7 @@ def main():
argument_spec = BitbucketHelper.bitbucket_argument_spec()
argument_spec.update(
repository=dict(type='str', required=True),
workspace=dict(
type='str', aliases=['username'], required=True,
deprecated_aliases=[dict(name='username', version='6.0.0', collection_name='community.general')],
),
workspace=dict(type='str', required=True),
public_key=dict(type='str'),
private_key=dict(type='str', no_log=True),
state=dict(type='str', choices=['present', 'absent'], required=True),

View file

@ -30,10 +30,9 @@ options:
workspace:
description:
- The repository owner.
- Alias I(username) has been deprecated and will become an alias of I(user) in community.general 6.0.0.
- I(username) used to be an alias of this option. Since community.general 6.0.0 it is an alias of I(user).
type: str
required: true
aliases: [ username ]
name:
description:
- The FQDN of the known host.
@ -255,10 +254,7 @@ def main():
argument_spec = BitbucketHelper.bitbucket_argument_spec()
argument_spec.update(
repository=dict(type='str', required=True),
workspace=dict(
type='str', aliases=['username'], required=True,
deprecated_aliases=[dict(name='username', version='6.0.0', collection_name='community.general')],
),
workspace=dict(type='str', required=True),
name=dict(type='str', required=True),
key=dict(type='str', no_log=False),
state=dict(type='str', choices=['present', 'absent'], required=True),

View file

@ -27,10 +27,9 @@ options:
workspace:
description:
- The repository owner.
- Alias I(username) has been deprecated and will become an alias of I(user) in community.general 6.0.0.
- I(username) used to be an alias of this option. Since community.general 6.0.0 it is an alias of I(user).
type: str
required: true
aliases: [ username ]
name:
description:
- The pipeline variable name.
@ -215,10 +214,7 @@ def main():
argument_spec = BitbucketHelper.bitbucket_argument_spec()
argument_spec.update(
repository=dict(type='str', required=True),
workspace=dict(
type='str', aliases=['username'], required=True,
deprecated_aliases=[dict(name='username', version='6.0.0', collection_name='community.general')],
),
workspace=dict(type='str', required=True),
name=dict(type='str', required=True),
value=dict(type='str'),
secured=dict(type='bool', default=False),

View file

@ -27,7 +27,7 @@ options:
gitlab_group:
description:
- The C(full_path) of the GitLab group the member is added to/removed from.
- Setting this to C(name) or C(path) is deprecated and will be removed in community.general 6.0.0. Use C(full_path) instead.
- Setting this to C(name) or C(path) has been disallowed since community.general 6.0.0. Use C(full_path) instead.
required: true
type: str
gitlab_user:
@ -176,12 +176,6 @@ class GitLabGroup(object):
for group in groups:
if group.full_path == gitlab_group:
return group.id
for group in groups:
if group.path == gitlab_group or group.name == gitlab_group:
self._module.deprecate(
msg="Setting 'gitlab_group' to 'name' or 'path' is deprecated. Use 'full_path' instead",
version="6.0.0", collection_name="community.general")
return group.id
# get all members in a group
def get_members_in_a_group(self, gitlab_group_id):