From b6f52a4b812a73da0c56eb5a42c3250692229dd5 Mon Sep 17 00:00:00 2001 From: Ganesh B Nalawade Date: Mon, 25 Mar 2019 13:30:13 +0530 Subject: [PATCH] Fix netconf plugin dispatch response Fixes #53236 * If dispatch() rpc response has data element return the xml string from `` element else return the complete xml string from ``. (cherry picked from commit aac5ef5e13e692c09bfd30772311733878b01035) --- changelogs/fragments/netconf_plugin_dispatch_fix.yaml | 3 +++ lib/ansible/plugins/netconf/__init__.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/netconf_plugin_dispatch_fix.yaml diff --git a/changelogs/fragments/netconf_plugin_dispatch_fix.yaml b/changelogs/fragments/netconf_plugin_dispatch_fix.yaml new file mode 100644 index 00000000000..abbc791bf84 --- /dev/null +++ b/changelogs/fragments/netconf_plugin_dispatch_fix.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: +- Fix netconf plugin dispatch response (https://github.com/ansible/ansible/issues/53236) diff --git a/lib/ansible/plugins/netconf/__init__.py b/lib/ansible/plugins/netconf/__init__.py index 1ccc767da18..a56df1576a9 100644 --- a/lib/ansible/plugins/netconf/__init__.py +++ b/lib/ansible/plugins/netconf/__init__.py @@ -208,7 +208,7 @@ class NetconfBase(AnsiblePlugin): raise ValueError('rpc_command value must be provided') req = fromstring(rpc_command) resp = self.m.dispatch(req, source=source, filter=filter) - return resp.data_xml if hasattr(resp, 'data_xml') else resp.xml + return resp.data_xml if resp.data_ele else resp.xml @ensure_connected def lock(self, target="candidate"):