mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
rax modules improvements
* Catch issues with invalid regions * Ensure we send string only data as meta values in the rax module * Add public_key/lookup example for rax_keypair * Clean up import statements
This commit is contained in:
committed by
Michael DeHaan
parent
2c7275e8a9
commit
37f096a6bb
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python -tt
|
||||
#!/usr/bin/python
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
@@ -55,15 +55,11 @@ EXAMPLES = '''
|
||||
register: my_queue
|
||||
'''
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
try:
|
||||
import pyrax
|
||||
HAS_PYRAX = True
|
||||
except ImportError:
|
||||
print("failed=True msg='pyrax is required for this module'")
|
||||
sys.exit(1)
|
||||
HAS_PYRAX = False
|
||||
|
||||
|
||||
def cloud_queue(module, state, name):
|
||||
@@ -76,6 +72,10 @@ def cloud_queue(module, state, name):
|
||||
instance = {}
|
||||
|
||||
cq = pyrax.queues
|
||||
if not cq:
|
||||
module.fail_json(msg='Failed to instantiate client. This '
|
||||
'typically indicates an invalid region or an '
|
||||
'incorrectly capitalized region name.')
|
||||
|
||||
for queue in cq.list():
|
||||
if name != queue.name:
|
||||
@@ -126,6 +126,9 @@ def main():
|
||||
required_together=rax_required_together()
|
||||
)
|
||||
|
||||
if not HAS_PYRAX:
|
||||
module.fail_json(msg='pyrax is required for this module')
|
||||
|
||||
name = module.params.get('name')
|
||||
state = module.params.get('state')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user