mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-22 22:11:44 -07:00
Remove deprecated get_exception API
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
caefe31125
commit
6bd0fbb63c
42 changed files with 284 additions and 409 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue