retire shade in favor of openstacksdk for openstack modules (#40532)

* Establish connection through openstacksdk
* Switch from shade to openstacksdk
* fix typo in link to openstacksdk
* remove nova_client usage
* further remove of min_version from openstack modules
This commit is contained in:
Artem Goncharov 2018-05-26 03:40:39 +02:00 committed by Monty Taylor
commit 89ce826a9f
51 changed files with 266 additions and 321 deletions

View file

@ -78,7 +78,7 @@ options:
availability_zone:
description:
- Ignored. Present for backwards compatibility
requirements: ["shade"]
requirements: ["openstacksdk"]
'''
EXAMPLES = '''
@ -152,11 +152,6 @@ def main():
module_kwargs = openstack_module_kwargs()
module = AnsibleModule(argument_spec, **module_kwargs)
if module.params['nat_destination']:
min_version = '1.8.0'
else:
min_version = None
server_name_or_id = module.params['server']
state = module.params['state']
network = module.params['network']
@ -168,9 +163,9 @@ def main():
timeout = module.params['timeout']
purge = module.params['purge']
shade, cloud = openstack_cloud_from_module(module, min_version=min_version)
sdk, cloud = openstack_cloud_from_module(module)
try:
server = cloud.get_server(server_name_or_id)
if server is None:
module.fail_json(
@ -251,7 +246,7 @@ def main():
module.exit_json(changed=True)
module.exit_json(changed=changed, floating_ip=f_ip)
except shade.OpenStackCloudException as e:
except sdk.exceptions.OpenStackCloudException as e:
module.fail_json(msg=str(e), extra_data=e.extra_data)