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"):