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

@ -106,6 +106,8 @@ import tempfile
import platform
import pipes
import shlex
from ansible.module_utils.basic import *
from ansible.module_utils.pycompat24 import get_exception
CRONCMD = "/usr/bin/crontab"
@ -147,7 +149,8 @@ class CronVar(object):
f = open(self.cron_file, 'r')
self.lines = f.read().splitlines()
f.close()
except IOError, e:
except IOError:
e = get_exception
# cron file does not exist
return
except:
@ -203,7 +206,8 @@ class CronVar(object):
try:
os.unlink(self.cron_file)
return True
except OSError, e:
except OSError:
e = get_exception
# cron file does not exist
return False
except:
@ -425,7 +429,5 @@ def main():
# --- should never get here
module.exit_json(msg="Unable to execute cronvar task.")
# import module snippets
from ansible.module_utils.basic import *
main()