Fixed modules/system py files for 2.4 to 3.5 exceptions (#2367)

This commit is contained in:
Chris Weber 2016-06-03 06:23:55 -07:00 committed by Matt Clay
commit 891245c6f6
12 changed files with 95 additions and 56 deletions

View file

@ -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()