Dropped symbolic links and plugin routing for deprecated module names

With Ansible OpenStack collection 2.0.0 we break backward
compatibility to older releases, mainly due to breaking changes
coming with openstacksdk >=0.99.0. For example, results will change
for most Ansible modules in this collection.

We take this opportunity to drop the symbolic links with prefix
os_ in plugins/modules and the plugin routing in meta/runtime.yml.
This means users have to call modules of the Ansible OpenStack
collection using their FQCN (Fully Qualified Collection Name) such
as openstack.cloud.server. Short module names such as os_server
will now raise an Ansible error. This also decreases the likelihood
of incompatible Ansible code going undetected.

Symbolic links were introduced to keep our collection backward
compatible to user code which was written for old(er) Ansible releases
which did not have support for collections and where OpenStack modules
where named with a prefix os_ such as os_server which is nowadays
known and stored as openstack.cloud.server.

In Ansible aka ansible-base 2.10, a internal routing table
lib/ansible/config/ansible_builtin_runtime.yml [1] was introduced which
Ansible uses to resolve deprecated module names missing the FQCN (Fully
Qualified Collection Name). Additionally, collections can define their
own plugin routing table in meta/runtime.yml [2] which we did.

In ansible-base 2.10 and ansible-core 2.11 or later, if a user uses a
short module name and the collections keyword is not used, Ansible
will first look in the internal routing table, get an FQCN, and then
looks in the collection for that FQCN. If there is another routing
entry for that new name in that collection's meta/runtime.yml,
Ansible will continue with that redirect. If it does not find another
redirect, Ansible will look for the plugin itself, so it will not
find a redirect in the collection before looking at its internal
redirects. Except if the user uses a FQCN, then it looks directly in
that collection.

Ansible 2.9 and 2.8 do not have any notion of these redirects with a
plugin routing table, backward compatibility with deprecated os_*
module names is solely achieved with symbolic links. Ansible releases
older than 2.11 are EOL [3], so usage of os_* symlinks should reduce
soon.

[1] https://github.com/ansible/ansible/blob/devel/lib/ansible/config/ansible_builtin_runtime.yml
[2] https://github.com/openstack/ansible-collections-openstack/blob/master/meta/runtime.yml
[3] https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html

Change-Id: I28cc05c95419b72552899c926721eb87fb6f0868
This commit is contained in:
Jakob Meng
2022-07-20 10:12:10 +02:00
parent fd15087c4d
commit b87ae7dcce
80 changed files with 8 additions and 798 deletions

View File

@@ -36,34 +36,7 @@ import os
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six import iteritems
OVERRIDES = {'os_client_config': 'config',
'os_endpoint': 'catalog_endpoint',
'os_flavor': 'compute_flavor',
'os_flavor_info': 'compute_flavor_info',
'os_group': 'identity_group',
'os_group_info': 'identity_group_info',
'os_ironic': 'baremetal_node',
'os_ironic_inspect': 'baremetal_inspect',
'os_ironic_node': 'baremetal_node_action',
'os_keystone_domain': 'identity_domain',
'os_keystone_domain_info': 'identity_domain_info',
'os_keystone_endpoint': 'endpoint',
'os_keystone_identity_provider': 'federation_idp',
'os_keystone_identity_provider_info': 'federation_idp_info',
'os_keystone_mapping': 'federation_mapping',
'os_keystone_mapping_info': 'federation_mapping_info',
'os_keystone_role': 'identity_role',
'os_keystone_service': 'catalog_service',
'os_listener': 'lb_listener',
'os_member': 'lb_member',
'os_nova_flavor': 'compute_flavor',
'os_nova_host_aggregate': 'host_aggregate',
'os_pool': 'lb_pool',
'os_user': 'identity_user',
'os_user_group': 'group_assignment',
'os_user_info': 'identity_user_info',
'os_user_role': 'role_assignment',
'os_zone': 'dns_zone'}
OVERRIDES = {}
CUSTOM_VAR_PARAMS = ['min_ver', 'max_ver']
@@ -320,7 +293,7 @@ class OpenStackModule:
"The '%s' module has been renamed to '%s' in openstack "
"collection: openstack.cloud.%s" % (
self.module_name, new_module_name, new_module_name),
version='2.0.0', collection_name='openstack.cloud')
version='3.0.0', collection_name='openstack.cloud')
def openstack_cloud_from_module(self):
"""Sets up connection to cloud using provided options. Checks if all

View File

@@ -16,8 +16,6 @@ description:
available to the flavor, or both. When specifying multiple filters,
*ALL* filters must match on a flavor before that flavor is returned as
a fact.
- This module was called C(openstack.cloud.compute_flavor_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(openstack.cloud.compute_flavor_info) module no longer returns C(ansible_facts)!
notes:
- The result contains a list of unsorted flavors.
options:
@@ -206,8 +204,6 @@ class ComputeFlavorInfoModule(OpenStackModule):
supports_check_mode=True
)
deprecated_names = ('openstack.cloud.compute_flavor_facts')
def run(self):
name = self.params['name']
vcpus = self.params['vcpus']

View File

@@ -1 +0,0 @@
object_container.py

View File

@@ -9,8 +9,6 @@ short_description: Retrieve information about one or more OpenStack domains
author: OpenStack Ansible SIG
description:
- Retrieve information about a one or more OpenStack domains
- This module was called C(openstack.cloud.identity_domain_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(openstack.cloud.identity_domain_info) module no longer returns C(ansible_facts)!
options:
name:
description:
@@ -99,8 +97,6 @@ class IdentityDomainInfoModule(OpenStackModule):
supports_check_mode=True
)
deprecated_names = ('openstack.cloud.identity_domain_facts')
def run(self):
name = self.params['name']
filters = self.params['filters'] or {}

View File

@@ -9,8 +9,6 @@ short_description: Retrieve information about one or more OpenStack users
author: OpenStack Ansible SIG
description:
- Retrieve information about a one or more OpenStack users
- This module was called C(openstack.cloud.identity_user_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(openstack.cloud.identity_user_info) module no longer returns C(ansible_facts)!
options:
name:
description:
@@ -143,8 +141,6 @@ class IdentityUserInfoModule(OpenStackModule):
supports_check_mode=True
)
deprecated_names = ('openstack.cloud.identity_user_facts')
def run(self):
name = self.params['name']
domain = self.params['domain']

View File

@@ -447,8 +447,6 @@ from ansible_collections.openstack.cloud.plugins.module_utils.openstack import O
class ImageModule(OpenStackModule):
deprecated_names = ('os_image', 'openstack.cloud.os_image')
argument_spec = dict(
name=dict(required=True, type='str'),
id=dict(type='str'),

View File

@@ -10,8 +10,6 @@ short_description: Retrieve information about an image within OpenStack.
author: OpenStack Ansible SIG
description:
- Retrieve information about a image image from OpenStack.
- This module was called C(openstack.cloud.image_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(openstack.cloud.image_info) module no longer returns C(ansible_facts)!
options:
image:
description:
@@ -376,8 +374,6 @@ from ansible_collections.openstack.cloud.plugins.module_utils.openstack import O
class ImageInfoModule(OpenStackModule):
deprecated_names = ('openstack.cloud.os_image_facts', 'openstack.cloud.os_image_info')
argument_spec = dict(
image=dict(type='str', required=False),
filters=dict(type='dict', required=False, aliases=['properties']),

View File

@@ -84,7 +84,6 @@ from ansible_collections.openstack.cloud.plugins.module_utils.openstack import (
class KeyPairModule(OpenStackModule):
deprecated_names = ('os_keypair', 'openstack.cloud.os_keypair')
argument_spec = dict(
name=dict(required=True),

View File

@@ -10,8 +10,6 @@ short_description: Retrieve information about one or more OpenStack networks.
author: OpenStack Ansible SIG
description:
- Retrieve information about one or more networks from OpenStack.
- This module was called C(openstack.cloud.networks_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(openstack.cloud.networks_info) module no longer returns C(ansible_facts)!
options:
name:
description:
@@ -174,9 +172,6 @@ from ansible_collections.openstack.cloud.plugins.module_utils.openstack import O
class NetworkInfoModule(OpenStackModule):
deprecated_names = ('networks_facts', 'openstack.cloud.networks_facts')
argument_spec = dict(
name=dict(required=False, default=None),
filters=dict(required=False, type='dict', default=None)

View File

@@ -1 +0,0 @@
auth.py

View File

@@ -1 +0,0 @@
config.py

View File

@@ -1 +0,0 @@
coe_cluster.py

View File

@@ -1 +0,0 @@
coe_cluster_template.py

View File

@@ -1 +0,0 @@
compute_flavor_info.py

View File

@@ -1 +0,0 @@
floating_ip.py

View File

@@ -1 +0,0 @@
identity_group.py

View File

@@ -1 +0,0 @@
identity_group_info.py

View File

@@ -1 +0,0 @@
image.py

View File

@@ -1 +0,0 @@
image_info.py

View File

@@ -1 +0,0 @@
baremetal_node.py

View File

@@ -1 +0,0 @@
baremetal_inspect.py

View File

@@ -1 +0,0 @@
baremetal_node_action.py

View File

@@ -1 +0,0 @@
keypair.py

View File

@@ -1 +0,0 @@
identity_domain.py

View File

@@ -1 +0,0 @@
identity_domain_info.py

View File

@@ -1 +0,0 @@
endpoint.py

View File

@@ -1 +0,0 @@
keystone_federation_protocol.py

View File

@@ -1 +0,0 @@
keystone_federation_protocol_info.py

View File

@@ -1 +0,0 @@
federation_idp.py

View File

@@ -1 +0,0 @@
federation_idp_info.py

View File

@@ -1 +0,0 @@
federation_mapping.py

View File

@@ -1 +0,0 @@
federation_mapping_info.py

View File

@@ -1 +0,0 @@
identity_role.py

View File

@@ -1 +0,0 @@
catalog_service.py

View File

@@ -1 +0,0 @@
lb_listener.py

View File

@@ -1 +0,0 @@
loadbalancer.py

View File

@@ -1 +0,0 @@
lb_member.py

View File

@@ -1 +0,0 @@
network.py

View File

@@ -1 +0,0 @@
networks_info.py

View File

@@ -1 +0,0 @@
compute_flavor.py

View File

@@ -1 +0,0 @@
host_aggregate.py

View File

@@ -1 +0,0 @@
object.py

View File

@@ -1 +0,0 @@
lb_pool.py

View File

@@ -1 +0,0 @@
port.py

View File

@@ -1 +0,0 @@
port_info.py

View File

@@ -1 +0,0 @@
project.py

View File

@@ -1 +0,0 @@
project_access.py

View File

@@ -1 +0,0 @@
project_info.py

View File

@@ -1 +0,0 @@
quota.py

View File

@@ -1 +0,0 @@
recordset.py

View File

@@ -1 +0,0 @@
router.py

View File

@@ -1 +0,0 @@
routers_info.py

View File

@@ -1 +0,0 @@
security_group.py

View File

@@ -1 +0,0 @@
security_group_rule.py

View File

@@ -1 +0,0 @@
server.py

View File

@@ -1 +0,0 @@
server_action.py

View File

@@ -1 +0,0 @@
server_group.py

View File

@@ -1 +0,0 @@
server_info.py

View File

@@ -1 +0,0 @@
server_metadata.py

View File

@@ -1 +0,0 @@
server_volume.py

View File

@@ -1 +0,0 @@
stack.py

View File

@@ -1 +0,0 @@
subnet.py

View File

@@ -1 +0,0 @@
subnets_info.py

View File

@@ -1 +0,0 @@
identity_user.py

View File

@@ -1 +0,0 @@
group_assignment.py

View File

@@ -1 +0,0 @@
identity_user_info.py

View File

@@ -1 +0,0 @@
role_assignment.py

View File

@@ -1 +0,0 @@
volume.py

View File

@@ -1 +0,0 @@
volume_snapshot.py

View File

@@ -1 +0,0 @@
dns_zone.py

View File

@@ -9,8 +9,6 @@ short_description: Retrieve information about ports within OpenStack.
author: OpenStack Ansible SIG
description:
- Retrieve information about ports from OpenStack.
- This module was called C(openstack.cloud.port_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(openstack.cloud.port_info) module no longer returns C(ansible_facts)!
options:
port:
description:

View File

@@ -9,8 +9,6 @@ short_description: Retrieve information about one or more OpenStack projects
author: OpenStack Ansible SIG
description:
- Retrieve information about a one or more OpenStack projects
- This module was called C(openstack.cloud.project_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(openstack.cloud.project_info) module no longer returns C(ansible_facts)!
options:
name:
description:
@@ -121,8 +119,6 @@ from ansible_collections.openstack.cloud.plugins.module_utils.openstack import O
class IdentityProjectInfoModule(OpenStackModule):
deprecated_names = ('project_facts', 'openstack.cloud.project_facts')
argument_spec = dict(
name=dict(required=False),
domain=dict(required=False),

View File

@@ -191,8 +191,6 @@ from ansible_collections.openstack.cloud.plugins.module_utils.openstack import O
class RouterInfoModule(OpenStackModule):
deprecated_names = ('os_routers_info', 'openstack.cloud.os_routers_info')
argument_spec = dict(
name=dict(required=False, default=None),
filters=dict(required=False, type='dict', default={})

View File

@@ -303,7 +303,6 @@ def _ports_match(protocol, module_min, module_max, rule_min, rule_max):
class SecurityGroupRuleModule(OpenStackModule):
deprecated_names = ('os_security_group_rule', 'openstack.cloud.os_security_group_rule')
argument_spec = dict(
security_group=dict(required=True),

View File

@@ -481,7 +481,6 @@ def _parse_meta(meta):
class ServerModule(OpenStackModule):
deprecated_names = ('os_server', 'openstack.cloud.os_server')
argument_spec = dict(
name=dict(required=True),

View File

@@ -116,8 +116,6 @@ _admin_actions = ['pause', 'unpause', 'suspend', 'resume', 'lock', 'unlock', 'sh
class ServerActionModule(OpenStackModule):
deprecated_names = ('os_server_action', 'openstack.cloud.os_server_action')
argument_spec = dict(
server=dict(required=True, type='str'),
action=dict(required=True, type='str',

View File

@@ -10,8 +10,6 @@ short_description: Retrieve information about one or more compute instances
author: OpenStack Ansible SIG
description:
- Retrieve information about server instances from OpenStack.
- This module was called C(os_server_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(openstack.cloud.server_info) module no longer returns C(ansible_facts)!
notes:
- The result contains a list of servers.
options:
@@ -62,8 +60,6 @@ from ansible_collections.openstack.cloud.plugins.module_utils.openstack import O
class ServerInfoModule(OpenStackModule):
deprecated_names = ('os_server_info', 'openstack.cloud.os_server_info')
argument_spec = dict(
server=dict(required=False),
detailed=dict(required=False, type='bool', default=False),

View File

@@ -10,8 +10,6 @@ short_description: Retrieve information about one or more OpenStack subnets.
author: OpenStack Ansible SIG
description:
- Retrieve information about one or more subnets from OpenStack.
- This module was called C(openstack.cloud.subnets_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(openstack.cloud.subnets_info) module no longer returns C(ansible_facts)!
options:
name:
description:
@@ -133,9 +131,6 @@ from ansible_collections.openstack.cloud.plugins.module_utils.openstack import O
class SubnetInfoModule(OpenStackModule):
deprecated_names = ('subnets_facts', 'openstack.cloud.subnets_facts')
argument_spec = dict(
name=dict(required=False, default=None, aliases=['subnet']),
filters=dict(required=False, type='dict', default=None)