Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.0.0] Bump version to 5.0.0, remove deprecated features #4516

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions changelogs/fragments/4516-deprecation-removals.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
removed_features:
- xfconf - the ``get`` state has been removed. Use the ``xfconf_info`` module instead (https://github.com/ansible-collections/community.general/pull/4516).
- dnsimple - remove support for dnsimple < 2.0.0 (https://github.com/ansible-collections/community.general/pull/4516).
- proxmox, proxmox_kvm, proxmox_snap - no longer allow to specify a VM name that matches multiple VMs. If this happens, the modules now fail (https://github.com/ansible-collections/community.general/pull/4516).
- ali_instance_info - removed the options ``availability_zone``, ``instance_ids``, and ``instance_names``. Use filter item ``zone_id`` instead of ``availability_zone``, filter item ``instance_ids`` instead of ``instance_ids``, and filter item ``instance_name`` instead of ``instance_names`` (https://github.com/ansible-collections/community.general/pull/4516).
- linode - removed the ``backupsenabled`` option. Use ``backupweeklyday`` or ``backupwindow`` to enable backups (https://github.com/ansible-collections/community.general/pull/4516).
- serverless - removed the ``functions`` option. It was not used by the module (https://github.com/ansible-collections/community.general/pull/4516).
- compose - removed various deprecated aliases. Use the version with ``_`` instead of ``-`` instead (https://github.com/ansible-collections/community.general/pull/4516).
- homebrew, homebrew_cask - removed the deprecated alias ``update-brew`` of ``update_brew`` (https://github.com/ansible-collections/community.general/pull/4516).
- apt_rpm - removed the deprecated alias ``update-cache`` of ``update_cache`` (https://github.com/ansible-collections/community.general/pull/4516).
- opkg - removed the deprecated alias ``update-cache`` of ``update_cache`` (https://github.com/ansible-collections/community.general/pull/4516).
- pacman - removed the deprecated alias ``update-cache`` of ``update_cache`` (https://github.com/ansible-collections/community.general/pull/4516).
- slackpkg - removed the deprecated alias ``update-cache`` of ``update_cache`` (https://github.com/ansible-collections/community.general/pull/4516).
- urpmi - removed the deprecated alias ``no-recommends`` of ``no_recommends`` (https://github.com/ansible-collections/community.general/pull/4516).
- urpmi - removed the deprecated alias ``update-cache`` of ``update_cache`` (https://github.com/ansible-collections/community.general/pull/4516).
- xbps - removed the deprecated alias ``update-cache`` of ``update_cache`` (https://github.com/ansible-collections/community.general/pull/4516).
- github_deploy_key - removed the deprecated alias ``2fa_token`` of ``otp`` (https://github.com/ansible-collections/community.general/pull/4516).
- pacman - if ``update_cache=true`` is used with ``name`` or ``upgrade``, the changed state will now also indicate if only the cache was updated. To keep the old behavior - only indicate ``changed`` when a package was installed/upgraded -, use ``changed_when`` as indicated in the module examples (https://github.com/ansible-collections/community.general/pull/4516).
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace: community
name: general
version: 4.8.0
version: 5.0.0
readme: README.md
authors:
- Ansible (https://github.com/ansible)
Expand Down
9 changes: 1 addition & 8 deletions plugins/module_utils/proxmox.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,7 @@ def get_vmid(self, name, ignore_missing=False, choose_first_if_multiple=False):

self.module.fail_json(msg='No VM with name %s found' % name)
elif len(vms) > 1:
if choose_first_if_multiple:
self.module.deprecate(
'Multiple VMs with name %s found, choosing the first one. ' % name +
'This will be an error in the future. To ensure the correct VM is used, ' +
'also pass the vmid parameter.',
version='5.0.0', collection_name='community.general')
else:
self.module.fail_json(msg='Multiple VMs with name %s found, provide vmid instead' % name)
self.module.fail_json(msg='Multiple VMs with name %s found, provide vmid instead' % name)

return vms[0]

Expand Down
43 changes: 3 additions & 40 deletions plugins/modules/cloud/alicloud/ali_instance_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,6 @@
- This module was called C(ali_instance_facts) before Ansible 2.9. The usage did not change.

options:
availability_zone:
description:
- Aliyun availability zone ID in which to launch the instance.
- Deprecated parameter, it will be removed in community.general 5.0.0. Please use filter item I(zone_id) instead.
aliases: ['alicloud_zone']
type: str
instance_names:
description:
- A list of ECS instance names.
- Deprecated parameter, it will be removed in community.general 5.0.0. Please use filter item I(instance_name) instead.
aliases: ["names"]
type: list
elements: str
instance_ids:
description:
- A list of ECS instance ids.
aliases: ["ids"]
type: list
elements: str
name_prefix:
description:
- Use a instance name prefix to filter ecs instances.
Expand All @@ -67,8 +48,8 @@
- A dict of filters to apply. Each dict item consists of a filter key and a filter value. The filter keys can be
all of request parameters. See U(https://www.alibabacloud.com/help/doc-detail/25506.htm) for parameter details.
Filter keys can be same as request parameter name or be lower case and use underscore ("_") or dash ("-") to
connect different words in one parameter. 'InstanceIds' should be a list and it will be appended to
I(instance_ids) automatically. 'Tag.n.Key' and 'Tag.n.Value' should be a dict and using I(tags) instead.
connect different words in one parameter. 'InstanceIds' should be a list.
'Tag.n.Key' and 'Tag.n.Value' should be a dict and using I(tags) instead.
type: dict
version_added: '0.2.0'
author:
Expand Down Expand Up @@ -376,11 +357,6 @@
def main():
argument_spec = ecs_argument_spec()
argument_spec.update(dict(
availability_zone=dict(aliases=['alicloud_zone'],
removed_in_version="5.0.0", removed_from_collection="community.general"),
instance_ids=dict(type='list', elements='str', aliases=['ids'],
removed_in_version="5.0.0", removed_from_collection="community.general"),
instance_names=dict(type='list', elements='str', aliases=['names']),
name_prefix=dict(type='str'),
tags=dict(type='dict', aliases=['instance_tags']),
filters=dict(type='dict')
Expand All @@ -398,21 +374,12 @@ def main():

instances = []
instance_ids = []
ids = module.params['instance_ids']
ids = []
name_prefix = module.params['name_prefix']
names = module.params['instance_names']
zone_id = module.params['availability_zone']
if ids and (not isinstance(ids, list) or len(ids) < 1):
module.fail_json(msg='instance_ids should be a list of instances, aborting')

if names and (not isinstance(names, list) or len(names) < 1):
module.fail_json(msg='instance_names should be a list of instances, aborting')

filters = module.params['filters']
if not filters:
filters = {}
if not ids:
ids = []
for key, value in list(filters.items()):
if key in ["InstanceIds", "instance_ids", "instance-ids"] and isinstance(ids, list):
for id in value:
Expand All @@ -422,10 +389,6 @@ def main():
filters['instance_ids'] = ids
if module.params['tags']:
filters['tags'] = module.params['tags']
if zone_id:
filters['zone_id'] = zone_id
if names:
filters['instance_name'] = names[0]

for inst in ecs.describe_instances(**filters):
if name_prefix:
Expand Down
6 changes: 0 additions & 6 deletions plugins/modules/cloud/linode/linode.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@
description:
- Set threshold for average IO ops/sec over 2 hour period.
type: int
backupsenabled:
description:
- Deprecated parameter, it will be removed in community.general C(5.0.0).
- To enable backups pass values to either I(backupweeklyday) or I(backupwindow).
type: int
backupweeklyday:
description:
- Day of the week to take backups.
Expand Down Expand Up @@ -594,7 +589,6 @@ def main():
alert_cpu_threshold=dict(type='int'),
alert_diskio_enabled=dict(type='bool'),
alert_diskio_threshold=dict(type='int'),
backupsenabled=dict(type='int', removed_in_version='5.0.0', removed_from_collection='community.general'),
backupweeklyday=dict(type='int'),
backupwindow=dict(type='int'),
displaygroup=dict(type='str', default=''),
Expand Down
10 changes: 5 additions & 5 deletions plugins/modules/cloud/misc/proxmox.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ def main():
if not vmid and state == 'present':
vmid = proxmox.get_nextvmid()
elif not vmid and hostname:
vmid = proxmox.get_vmid(hostname, choose_first_if_multiple=True)
vmid = proxmox.get_vmid(hostname)
elif not vmid:
module.exit_json(changed=False, msg="Vmid could not be fetched for the following action: %s" % state)

Expand All @@ -637,9 +637,9 @@ def main():
module.exit_json(changed=False, msg="VM with vmid = %s is already exists" % vmid)
# If no vmid was passed, there cannot be another VM named 'hostname'
if (not module.params['vmid'] and
proxmox.get_vmid(hostname, ignore_missing=True, choose_first_if_multiple=True) and
proxmox.get_vmid(hostname, ignore_missing=True) and
not module.params['force']):
vmid = proxmox.get_vmid(hostname, choose_first_if_multiple=True)
vmid = proxmox.get_vmid(hostname)
module.exit_json(changed=False, msg="VM with hostname %s already exists and has ID number %s" % (hostname, vmid))
elif not proxmox.get_node(node):
module.fail_json(msg="node '%s' not exists in cluster" % node)
Expand Down Expand Up @@ -681,9 +681,9 @@ def main():
module.exit_json(changed=False, msg="VM with vmid = %s is already exists" % vmid)
# If no vmid was passed, there cannot be another VM named 'hostname'
if (not module.params['vmid'] and
proxmox.get_vmid(hostname, ignore_missing=True, choose_first_if_multiple=True) and
proxmox.get_vmid(hostname, ignore_missing=True) and
not module.params['force']):
vmid = proxmox.get_vmid(hostname, choose_first_if_multiple=True)
vmid = proxmox.get_vmid(hostname)
module.exit_json(changed=False, msg="VM with hostname %s already exists and has ID number %s" % (hostname, vmid))
if not proxmox.get_vm(clone, ignore_missing=True):
module.exit_json(changed=False, msg="Container to be cloned does not exist")
Expand Down
8 changes: 4 additions & 4 deletions plugins/modules/cloud/misc/proxmox_kvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ def main():
module.fail_json(msg="Can't get the next vmid for VM {0} automatically. Ensure your cluster state is good".format(name))
else:
clone_target = clone or name
vmid = proxmox.get_vmid(clone_target, ignore_missing=True, choose_first_if_multiple=True)
vmid = proxmox.get_vmid(clone_target, ignore_missing=True)

if clone is not None:
# If newid is not defined then retrieve the next free id from ProxmoxAPI
Expand All @@ -1205,7 +1205,7 @@ def main():
proxmox.get_vm(vmid)

# Ensure the choosen VM name doesn't already exist when cloning
existing_vmid = proxmox.get_vmid(name, ignore_missing=True, choose_first_if_multiple=True)
existing_vmid = proxmox.get_vmid(name, ignore_missing=True)
if existing_vmid:
module.exit_json(changed=False, vmid=existing_vmid, msg="VM with name <%s> already exists" % name)

Expand All @@ -1231,8 +1231,8 @@ def main():
try:
if proxmox.get_vm(vmid, ignore_missing=True) and not (update or clone):
module.exit_json(changed=False, vmid=vmid, msg="VM with vmid <%s> already exists" % vmid)
elif proxmox.get_vmid(name, ignore_missing=True, choose_first_if_multiple=True) and not (update or clone):
module.exit_json(changed=False, vmid=proxmox.get_vmid(name, choose_first_if_multiple=True), msg="VM with name <%s> already exists" % name)
elif proxmox.get_vmid(name, ignore_missing=True) and not (update or clone):
module.exit_json(changed=False, vmid=proxmox.get_vmid(name), msg="VM with name <%s> already exists" % name)
elif not (node, name):
module.fail_json(msg='node, name is mandatory for creating/updating vm')
elif not proxmox.get_node(node):
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/cloud/misc/proxmox_snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def main():

# If hostname is set get the VM id from ProxmoxAPI
if not vmid and hostname:
vmid = proxmox.get_vmid(hostname, choose_first_if_multiple=True)
vmid = proxmox.get_vmid(hostname)
elif not vmid:
module.exit_json(changed=False, msg="Vmid could not be fetched for the following action: %s" % state)

Expand Down
10 changes: 0 additions & 10 deletions plugins/modules/cloud/misc/serverless.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@
- The name of the serverless framework project stage to deploy to.
- This uses the serverless framework default "dev".
type: str
functions:
description:
- A list of specific functions to deploy.
- If this is not provided, all functions in the service will be deployed.
- Deprecated parameter, it will be removed in community.general 5.0.0.
type: list
elements: str
default: []
region:
description:
- AWS region to deploy the service to.
Expand Down Expand Up @@ -159,8 +151,6 @@ def main():
argument_spec=dict(
service_path=dict(type='path', required=True),
state=dict(type='str', default='present', choices=['absent', 'present']),
functions=dict(type='list', elements='str',
removed_in_version="5.0.0", removed_from_collection="community.general"),
region=dict(type='str', default=''),
stage=dict(type='str', default=''),
deploy=dict(type='bool', default=True),
Expand Down
101 changes: 5 additions & 96 deletions plugins/modules/net_tools/dnsimple.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@
default: no
version_added: 3.5.0
requirements:
- "dnsimple >= 1.0.0"
notes:
- "Support for C(dnsimple < 2) is deprecated and will be removed in community.general 5.0.0."
- "dnsimple >= 2.0.0"
author: "Alex Coomans (@drcapulet)"
'''

Expand Down Expand Up @@ -153,80 +151,6 @@
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion


class DNSimpleV1():
"""class which uses dnsimple-python < 2"""

def __init__(self, account_email, account_api_token, sandbox, module):
"""init"""
self.module = module
self.account_email = account_email
self.account_api_token = account_api_token
self.sandbox = sandbox
self.dnsimple_client()

def dnsimple_client(self):
"""creates a dnsimple client object"""
if self.account_email and self.account_api_token:
self.client = DNSimple(sandbox=self.sandbox, email=self.account_email, api_token=self.account_api_token)
else:
self.client = DNSimple(sandbox=self.sandbox)

def get_all_domains(self):
"""returns a list of all domains"""
domain_list = self.client.domains()
return [d['domain'] for d in domain_list]

def get_domain(self, domain):
"""returns a single domain by name or id"""
try:
dr = self.client.domain(domain)['domain']
except DNSimpleException as e:
exception_string = str(e.args[0]['message'])
if re.match(r"^Domain .+ not found$", exception_string):
dr = None
else:
raise
return dr

def create_domain(self, domain):
"""create a single domain"""
return self.client.add_domain(domain)['domain']

def delete_domain(self, domain):
"""delete a single domain"""
self.client.delete(domain)

def get_records(self, domain, dnsimple_filter=None):
"""return dns ressource records which match a specified filter"""
return [r['record'] for r in self.client.records(str(domain), params=dnsimple_filter)]

def delete_record(self, domain, rid):
"""delete a single dns ressource record"""
self.client.delete_record(str(domain), rid)

def update_record(self, domain, rid, ttl=None, priority=None):
"""update a single dns ressource record"""
data = {}
if ttl:
data['ttl'] = ttl
if priority:
data['priority'] = priority
return self.client.update_record(str(domain), str(rid), data)['record']

def create_record(self, domain, name, record_type, content, ttl=None, priority=None):
"""create a single dns ressource record"""
data = {
'name': name,
'type': record_type,
'content': content,
}
if ttl:
data['ttl'] = ttl
if priority:
data['priority'] = priority
return self.client.add_record(str(domain), data)['record']


class DNSimpleV2():
"""class which uses dnsimple-python >= 2"""

Expand Down Expand Up @@ -336,16 +260,6 @@ def _get_paginated_result(self, operation, **options):
except ImportError:
DNSIMPLE_IMP_ERR.append(traceback.format_exc())

if not HAS_DNSIMPLE:
# try to import dnsimple < 2.0.0
try:
from dnsimple.dnsimple import __version__ as dnsimple_version
from dnsimple import DNSimple
from dnsimple.dnsimple import DNSimpleException
HAS_DNSIMPLE = True
except ImportError:
DNSIMPLE_IMP_ERR.append(traceback.format_exc())

from ansible.module_utils.basic import AnsibleModule, missing_required_lib, env_fallback


Expand Down Expand Up @@ -395,15 +309,10 @@ def main():
DNSIMPLE_MAJOR_VERSION = LooseVersion(dnsimple_version).version[0]

try:
if DNSIMPLE_MAJOR_VERSION > 1:
ds = DNSimpleV2(account_email, account_api_token, sandbox, module)
else:
module.deprecate(
'Support for python-dnsimple < 2 is deprecated. '
'Update python-dnsimple to version >= 2.0.0',
version='5.0.0', collection_name='community.general'
)
ds = DNSimpleV1(account_email, account_api_token, sandbox, module)
if DNSIMPLE_MAJOR_VERSION < 2:
module.fail_json(
msg='Support for python-dnsimple < 2 has been removed in community.general 5.0.0. Update python-dnsimple to version >= 2.0.0.')
ds = DNSimpleV2(account_email, account_api_token, sandbox, module)
# Let's figure out what operation we want to do
# No domain, return a list
if not domain:
Expand Down
Loading