mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-10 18:34:03 -07:00
Fix undefined variables, basestring usage, and some associated python3 issues
This commit is contained in:
parent
9f7b0dfc30
commit
225fa5d092
84 changed files with 652 additions and 963 deletions
|
@ -74,12 +74,18 @@ EXAMPLES = '''
|
|||
region: DFW
|
||||
'''
|
||||
|
||||
import json
|
||||
|
||||
try:
|
||||
import pyrax
|
||||
HAS_PYRAX = True
|
||||
except ImportError:
|
||||
HAS_PYRAX = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.rax import rax_argument_spec, rax_required_together, setup_rax_module
|
||||
from ansible.module_utils.six import string_types
|
||||
|
||||
|
||||
def rax_meta(module, address, name, server_id, meta):
|
||||
changed = False
|
||||
|
@ -128,7 +134,7 @@ def rax_meta(module, address, name, server_id, meta):
|
|||
meta[k] = ','.join(['%s' % i for i in v])
|
||||
elif isinstance(v, dict):
|
||||
meta[k] = json.dumps(v)
|
||||
elif not isinstance(v, basestring):
|
||||
elif not isinstance(v, string_types):
|
||||
meta[k] = '%s' % v
|
||||
|
||||
server = servers[0]
|
||||
|
@ -175,11 +181,5 @@ def main():
|
|||
rax_meta(module, address, name, server_id, meta)
|
||||
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.rax import *
|
||||
|
||||
### invoke the module
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue