diff --git a/changelogs/fragments/iosxr_netconf_config_commit_fix.yaml b/changelogs/fragments/iosxr_netconf_config_commit_fix.yaml new file mode 100644 index 00000000000..429f3c5c595 --- /dev/null +++ b/changelogs/fragments/iosxr_netconf_config_commit_fix.yaml @@ -0,0 +1,2 @@ +bugfixes: +- Confirmed commit fails with TypeError in IOS XR netconf plugin (https://github.com/ansible-collections/cisco.iosxr/issues/74) diff --git a/lib/ansible/plugins/netconf/__init__.py b/lib/ansible/plugins/netconf/__init__.py index b181f37696a..529cc260675 100644 --- a/lib/ansible/plugins/netconf/__init__.py +++ b/lib/ansible/plugins/netconf/__init__.py @@ -24,7 +24,7 @@ from functools import wraps from ansible.errors import AnsibleError from ansible.plugins import AnsiblePlugin -from ansible.module_utils._text import to_native +from ansible.module_utils._text import to_native, to_text from ansible.module_utils.basic import missing_required_lib try: @@ -269,6 +269,7 @@ class NetconfBase(AnsiblePlugin): and set a token on the ongoing confirmed commit :return: Returns xml string containing the RPC response received from remote host """ + timeout = to_text(timeout, errors='surrogate_or_strict') resp = self.m.commit(confirmed=confirmed, timeout=timeout, persist=persist) return resp.data_xml if hasattr(resp, 'data_xml') else resp.xml