mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-16 18:05:27 -07:00
Junos_config unicode (#23369)
* Try to handle unicode output more sensibly * Appears I'm getting latin1 instead Ugh.
This commit is contained in:
parent
1c61b9bae7
commit
689b93bf14
4 changed files with 8 additions and 8 deletions
|
@ -195,6 +195,7 @@ from ansible.module_utils.junos import junos_argument_spec
|
|||
from ansible.module_utils.junos import check_args as junos_check_args
|
||||
from ansible.module_utils.netconf import send_request
|
||||
from ansible.module_utils.six import string_types
|
||||
from ansible.module_utils._text import to_text, to_native
|
||||
|
||||
if sys.version_info < (2, 7):
|
||||
from xml.parsers.expat import ExpatError
|
||||
|
@ -238,7 +239,7 @@ def filter_delete_statements(module, candidate):
|
|||
if match is None:
|
||||
# Could not find configuration-set in reply, perhaps device does not support it?
|
||||
return candidate
|
||||
config = str(match.text)
|
||||
config = to_native(match.text, encoding='latin1')
|
||||
|
||||
modified_candidate = candidate[:]
|
||||
for index, line in enumerate(candidate):
|
||||
|
@ -331,7 +332,7 @@ def main():
|
|||
else:
|
||||
module.fail_json(msg='unable to retrieve device configuration')
|
||||
|
||||
result['__backup__'] = str(match.text).strip()
|
||||
result['__backup__'] = match.text.strip()
|
||||
|
||||
if module.params['rollback']:
|
||||
if not module.check_mode:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue