diff options
author | Michael Scherer <mscherer@users.noreply.github.com> | 2016-05-17 19:20:36 +0200 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2016-05-17 10:20:36 -0700 |
commit | b19a8a9b8f6ff9787b4725587ee86c9b7ce9798e (patch) | |
tree | 5d465a4530e95f6257dfb0d7be10ccabb891b085 /system/sysctl.py | |
parent | afce9e58554b7b07eeeb95d0c3ea08e72c6f3378 (diff) | |
download | ansible-modules-core-b19a8a9b8f6ff9787b4725587ee86c9b7ce9798e.tar.gz |
Port sysctl to a py3 and py24 compatible syntax (#3675)
Diffstat (limited to 'system/sysctl.py')
-rw-r--r-- | system/sysctl.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/system/sysctl.py b/system/sysctl.py index ae110b06..d5826f1f 100644 --- a/system/sysctl.py +++ b/system/sysctl.py @@ -275,7 +275,8 @@ class SysctlModule(object): f = open(self.sysctl_file, "r") lines = f.readlines() f.close() - except IOError, e: + except IOError: + e = get_exception() self.module.fail_json(msg="Failed to open %s: %s" % (self.sysctl_file, str(e))) for line in lines: @@ -325,7 +326,8 @@ class SysctlModule(object): try: for l in self.fixed_lines: f.write(l.strip() + "\n") - except IOError, e: + except IOError: + e = get_exception() self.module.fail_json(msg="Failed to write to file %s: %s" % (tmp_path, str(e))) f.flush() f.close() |