summaryrefslogtreecommitdiff
path: root/system/crypttab.py
diff options
context:
space:
mode:
authorChris Weber <chris.l.weber@gmail.com>2016-06-03 06:23:55 -0700
committerToshio Kuratomi <a.badger@gmail.com>2016-06-03 06:23:55 -0700
commit9e277aabb033b3ec823b4a2db7c0f7e315eaaf0b (patch)
tree47632394a6ce1fef4f71687f49a1a8dd6c9e9db2 /system/crypttab.py
parent3444cd1813612fb230425ef41f111dc3a5f38b4e (diff)
downloadansible-modules-extras-9e277aabb033b3ec823b4a2db7c0f7e315eaaf0b.tar.gz
Fixed modules/system py files for 2.4 to 3.5 exceptions (#2367)
Diffstat (limited to 'system/crypttab.py')
-rw-r--r--system/crypttab.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/system/crypttab.py b/system/crypttab.py
index 842b5bc7..4b36200c 100644
--- a/system/crypttab.py
+++ b/system/crypttab.py
@@ -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()