mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 14:41:23 -07:00
Several cleanups to many modules:
* Fix docs to specify when python2.6+ is required (due to a library dep). This helps us know when it is okay to use python2.6+ syntax in the file. * remove BabyJson returns. See #1211 This commit fixes all but the openstack modules. * Use if __name__ == '__main__' to only run the main part of the module if the module is run as a program. This allows for the potential to unittest the code later.
This commit is contained in:
parent
0567404c03
commit
5336217649
17 changed files with 186 additions and 114 deletions
|
@ -60,9 +60,9 @@ import sys
|
|||
|
||||
try:
|
||||
import selinux
|
||||
HAS_SELINUX = True
|
||||
except ImportError:
|
||||
print "failed=True msg='libselinux-python required for this module'"
|
||||
sys.exit(1)
|
||||
HAS_SELINUX = False
|
||||
|
||||
# getter subroutines
|
||||
def get_config_state(configfile):
|
||||
|
@ -130,6 +130,9 @@ def main():
|
|||
supports_check_mode=True
|
||||
)
|
||||
|
||||
if not HAS_SELINUX:
|
||||
module.fail_json(msg='libselinux-python required for this module')
|
||||
|
||||
# global vars
|
||||
changed=False
|
||||
msgs = []
|
||||
|
@ -204,5 +207,6 @@ def main():
|
|||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
main()
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue