mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-07 08:54:01 -07:00
Fixed modules/system py files for 2.4 to 3.5 exceptions (#2367)
This commit is contained in:
parent
868a4584a4
commit
891245c6f6
12 changed files with 95 additions and 56 deletions
|
@ -82,6 +82,9 @@ EXAMPLES = '''
|
|||
when: '/dev/mapper/luks-' in {{ item.device }}
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
|
||||
def main():
|
||||
|
||||
module = AnsibleModule(
|
||||
|
@ -126,7 +129,8 @@ def main():
|
|||
try:
|
||||
crypttab = Crypttab(path)
|
||||
existing_line = crypttab.match(name)
|
||||
except Exception, e:
|
||||
except Exception:
|
||||
e = get_exception
|
||||
module.fail_json(msg="failed to open and parse crypttab file: %s" % e,
|
||||
**module.params)
|
||||
|
||||
|
@ -358,6 +362,4 @@ class Options(dict):
|
|||
ret.append('%s=%s' % (k, v))
|
||||
return ','.join(ret)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue