mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-09 09:54:02 -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
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue