mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-09 01:44:03 -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
|
@ -84,6 +84,8 @@ EXAMPLES = '''
|
|||
'''
|
||||
|
||||
import datetime
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
|
||||
# exceptions --------------------------------------------------------------- {{{
|
||||
class OSXDefaultsException(Exception):
|
||||
|
@ -275,7 +277,7 @@ class OSXDefaults(object):
|
|||
|
||||
# Handle absent state
|
||||
if self.state == "absent":
|
||||
print "Absent state detected!"
|
||||
print ("Absent state detected!")
|
||||
if self.current_value is None:
|
||||
return False
|
||||
if self.module.check_mode:
|
||||
|
@ -376,10 +378,10 @@ def main():
|
|||
array_add=array_add, value=value, state=state, path=path)
|
||||
changed = defaults.run()
|
||||
module.exit_json(changed=changed)
|
||||
except OSXDefaultsException, e:
|
||||
except OSXDefaultsException:
|
||||
e = get_exception()
|
||||
module.fail_json(msg=e.message)
|
||||
|
||||
# /main ------------------------------------------------------------------- }}}
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue