Remove deprecated get_exception API

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2017-12-26 08:33:21 +05:30 committed by Brian Coca
commit 6bd0fbb63c
42 changed files with 284 additions and 409 deletions

View file

@ -255,7 +255,7 @@ dest:
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pycompat24 import get_exception
from ansible.module_utils._text import to_native
import os
import re
import time
@ -360,11 +360,10 @@ class PamdService(object):
stringline += '\n'
self.load_rules_from_string(stringline.replace("\\\n", ""))
except IOError:
e = get_exception()
except IOError as e:
self.ansible.fail_json(msg='Unable to open/read PAM module \
file %s with error %s. And line %s' %
(self.fname, str(e), stringline))
(self.fname, to_native(e), stringline))
def load_rules_from_string(self, stringvalue):
for line in stringvalue.splitlines():
@ -687,5 +686,6 @@ def main():
module.exit_json(changed=change, ansible_facts=facts)
if __name__ == '__main__':
main()