From 65a9369f684ef63f7862a3bda5dafb76e85c2957 Mon Sep 17 00:00:00 2001 From: Tim Rupp Date: Mon, 26 Nov 2018 20:59:03 -0800 Subject: [PATCH] Adds hasattr checks for rpc calls used in network_cli plugins (#49173) Network platforms that don't have cliconf plugin will fail when sending rpc calls for the reset_history and disable_response_logging functions because those are defined in cliconf exclusively at this time. This patch adds checks for those attributes before making the call (cherry picked from commit 0b5b5e69d867e3cd835a8c52f27ac07da26114ca) --- lib/ansible/plugins/connection/network_cli.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ansible/plugins/connection/network_cli.py b/lib/ansible/plugins/connection/network_cli.py index 6ed540426a0..63f7eb91dc0 100644 --- a/lib/ansible/plugins/connection/network_cli.py +++ b/lib/ansible/plugins/connection/network_cli.py @@ -281,8 +281,11 @@ class Connection(NetworkConnectionBase): self._play_context = play_context - self.reset_history() - self.disable_response_logging() + if hasattr(self, 'reset_history'): + self.reset_history() + if hasattr(self, 'disable_response_logging'): + self.disable_response_logging() + return messages def _connect(self):