Pull request for temp/iosxr-back (#58075)
* Fix python3 encoding with iosxr_config (#57919)
Python3 requires bytes when writing files.
(cherry picked from commit d40c44bd56
)
Depends-On https://github.com/ansible/ansible/pull/58073
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
* Add changelog fragment
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
ba30649af9
commit
2dac2d1601
2 changed files with 4 additions and 2 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- Fix python3 encoding issue with iosxr_config.
|
|
@ -236,7 +236,7 @@ time:
|
||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from ansible.module_utils._text import to_text
|
from ansible.module_utils._text import to_text, to_bytes
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.connection import ConnectionError
|
from ansible.module_utils.connection import ConnectionError
|
||||||
from ansible.module_utils.network.iosxr.iosxr import load_config, get_config, get_connection
|
from ansible.module_utils.network.iosxr.iosxr import load_config, get_config, get_connection
|
||||||
|
@ -251,7 +251,7 @@ def copy_file_to_node(module):
|
||||||
"""
|
"""
|
||||||
src = '/tmp/ansible_config.txt'
|
src = '/tmp/ansible_config.txt'
|
||||||
file = open(src, 'wb')
|
file = open(src, 'wb')
|
||||||
file.write(module.params['src'])
|
file.write(to_bytes(module.params['src'], errors='surrogate_or_strict'))
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
dst = '/harddisk:/ansible_config.txt'
|
dst = '/harddisk:/ansible_config.txt'
|
||||||
|
|
Loading…
Reference in a new issue