From ffe80a14f6c69c10e47b3f37c527fb3f8dbb53cc Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Wed, 24 Oct 2018 09:56:47 -0400 Subject: [PATCH] [2.7] ios check_rc: Default to sending text of exception, not the whole exception (#47300) * Default to sending text of exception, not the whole exception (cherry picked from commit 6a866a5) Co-authored-by: Nathaniel Case --- 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 9debea94f6f..8c1e64aca5a 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)