mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Fix modules' use of BOOLEANS*
* The canonical location of BOOLEANS has moved. Switch imports to use that. * clean up argument_spec use of booleans. * Clean up imports to not use wildcards * Remove usage of get_exception
This commit is contained in:
@@ -216,6 +216,12 @@ msg:
|
||||
sample: "interface bond0 config updated"
|
||||
'''
|
||||
|
||||
import os
|
||||
import re
|
||||
import tempfile
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
# handy helper for calling system calls.
|
||||
# calls AnsibleModule.run_command and prints a more appropriate message
|
||||
@@ -437,9 +443,9 @@ def main():
|
||||
virtual_mac=dict(type='str'),
|
||||
vids=dict(type='list'),
|
||||
pvid=dict(type='str'),
|
||||
mstpctl_portnetwork=dict(type='bool', choices=BOOLEANS),
|
||||
mstpctl_portadminedge=dict(type='bool', choices=BOOLEANS),
|
||||
mstpctl_bpduguard=dict(type='bool', choices=BOOLEANS),
|
||||
mstpctl_portnetwork=dict(type='bool'),
|
||||
mstpctl_portadminedge=dict(type='bool'),
|
||||
mstpctl_bpduguard=dict(type='bool'),
|
||||
clag_id=dict(type='str'),
|
||||
min_links=dict(type='int', default=1),
|
||||
mode=dict(type='str', default='802.3ad'),
|
||||
@@ -484,11 +490,6 @@ def main():
|
||||
|
||||
module.exit_json(changed=_changed, msg=_msg)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
import tempfile
|
||||
import os
|
||||
import re
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -164,6 +164,12 @@ msg:
|
||||
sample: "interface bond0 config updated"
|
||||
'''
|
||||
|
||||
import os
|
||||
import re
|
||||
import tempfile
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
# handy helper for calling system calls.
|
||||
# calls AnsibleModule.run_command and prints a more appropriate message
|
||||
@@ -373,8 +379,8 @@ def main():
|
||||
vids=dict(type='list'),
|
||||
pvid=dict(type='str'),
|
||||
mstpctl_treeprio=dict(type='str'),
|
||||
vlan_aware=dict(type='bool', choices=BOOLEANS),
|
||||
stp=dict(type='bool', default='yes', choices=BOOLEANS),
|
||||
vlan_aware=dict(type='bool'),
|
||||
stp=dict(type='bool', default='yes'),
|
||||
location=dict(type='str',
|
||||
default='/etc/network/interfaces.d')
|
||||
),
|
||||
@@ -410,11 +416,6 @@ def main():
|
||||
|
||||
module.exit_json(changed=_changed, msg=_msg)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
import tempfile
|
||||
import os
|
||||
import re
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -110,6 +110,14 @@ msg:
|
||||
sample: "interface bond0 config updated"
|
||||
'''
|
||||
|
||||
import re
|
||||
from urlparse import urlparse
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import AnsibleModule, platform
|
||||
# incompatible with ansible 1.4.4 - ubuntu 12.04 version
|
||||
# from ansible.module_utils.urls import *
|
||||
|
||||
|
||||
def check_url(module, url):
|
||||
parsed_url = urlparse(url)
|
||||
@@ -124,8 +132,7 @@ def check_url(module, url):
|
||||
def run_cl_cmd(module, cmd, check_rc=True):
|
||||
try:
|
||||
(rc, out, err) = module.run_command(cmd, check_rc=check_rc)
|
||||
except Exception:
|
||||
e = get_exception()
|
||||
except Exception as e:
|
||||
module.fail_json(msg=e.strerror)
|
||||
# trim last line as it is always empty
|
||||
ret = out.splitlines()
|
||||
@@ -301,7 +308,7 @@ def main():
|
||||
argument_spec=dict(
|
||||
src=dict(required=True, type='str'),
|
||||
version=dict(type='str'),
|
||||
switch_slot=dict(type='bool', choices=BOOLEANS, default=False),
|
||||
switch_slot=dict(type='bool', default=False),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -315,12 +322,5 @@ def main():
|
||||
install_img(module)
|
||||
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
# incompatible with ansible 1.4.4 - ubuntu 12.04 version
|
||||
# from ansible.module_utils.urls import *
|
||||
from urlparse import urlparse
|
||||
import re
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -209,6 +209,13 @@ msg:
|
||||
sample: "interface bond0 config updated"
|
||||
'''
|
||||
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import tempfile
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
# handy helper for calling system calls.
|
||||
# calls AnsibleModule.run_command and prints a more appropriate message
|
||||
@@ -401,10 +408,10 @@ def main():
|
||||
virtual_mac=dict(type='str'),
|
||||
vids=dict(type='list'),
|
||||
pvid=dict(type='str'),
|
||||
mstpctl_portnetwork=dict(type='bool', choices=BOOLEANS),
|
||||
mstpctl_portadminedge=dict(type='bool', choices=BOOLEANS),
|
||||
mstpctl_bpduguard=dict(type='bool', choices=BOOLEANS),
|
||||
clagd_enable=dict(type='bool', choices=BOOLEANS),
|
||||
mstpctl_portnetwork=dict(type='bool'),
|
||||
mstpctl_portadminedge=dict(type='bool'),
|
||||
mstpctl_bpduguard=dict(type='bool'),
|
||||
clagd_enable=dict(type='bool'),
|
||||
clagd_priority=dict(type='str'),
|
||||
clagd_peer_ip=dict(type='str'),
|
||||
clagd_sys_mac=dict(type='str'),
|
||||
@@ -446,10 +453,6 @@ def main():
|
||||
|
||||
module.exit_json(changed=_changed, msg=_msg)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -107,6 +107,9 @@ msg:
|
||||
sample: "interface bond0 config updated"
|
||||
'''
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
CL_LICENSE_PATH='/usr/cumulus/bin/cl-license'
|
||||
|
||||
def install_license(module):
|
||||
@@ -121,8 +124,7 @@ def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
src=dict(required=True, type='str'),
|
||||
force=dict(type='bool', choices=BOOLEANS,
|
||||
default=False)
|
||||
force=dict(type='bool', default=False)
|
||||
),
|
||||
)
|
||||
|
||||
@@ -142,9 +144,5 @@ def main():
|
||||
module.exit_json(changed=module.changed, msg=module.msg)
|
||||
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
# from ansible.module_utils.urls import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user