From 6a866a5e101591c8e6b37bfcf5d67b683c30a749 Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Wed, 24 Oct 2018 09:56:47 -0400 Subject: [PATCH] ios check_rc: Default to sending text of exception, not the whole exception (#47300) * Default to sending text of exception, not the whole exception --- changelogs/fragments/47300-ios-check_rc.yaml | 3 +++ lib/ansible/plugins/cliconf/ios.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/47300-ios-check_rc.yaml diff --git a/changelogs/fragments/47300-ios-check_rc.yaml b/changelogs/fragments/47300-ios-check_rc.yaml new file mode 100644 index 00000000000..82453a95262 --- /dev/null +++ b/changelogs/fragments/47300-ios-check_rc.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - Fix issue getting output from failed ios commands when ``check_rc=False`` diff --git a/lib/ansible/plugins/cliconf/ios.py b/lib/ansible/plugins/cliconf/ios.py index 0aa0d2ff660..cca4f719027 100644 --- a/lib/ansible/plugins/cliconf/ios.py +++ b/lib/ansible/plugins/cliconf/ios.py @@ -291,7 +291,7 @@ class Cliconf(CliconfBase): except AnsibleConnectionFailure as e: if check_rc: raise - out = getattr(e, 'err', e) + out = getattr(e, 'err', to_text(e)) responses.append(out)