From 9faf56a34524bfc5daf46957f21bf23cb258eb15 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Fri, 30 Sep 2016 15:00:10 -0400 Subject: [PATCH] fixes issue when calling save_config() and transport is nxapi (#17835) An unhandled exeception is raised with using nxapi transport and setting the save argument to true. This fix will allow the configuration to be saved regardless of the transport. fixes ansible/ansible-modules-core#5094 --- lib/ansible/module_utils/nxos.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/nxos.py b/lib/ansible/module_utils/nxos.py index 298c8e0cdca..86918f70048 100644 --- a/lib/ansible/module_utils/nxos.py +++ b/lib/ansible/module_utils/nxos.py @@ -60,7 +60,10 @@ class NxapiConfigMixin(object): self.execute(['no checkpoint %s' % checkpoint]) def save_config(self, **kwargs): - self.execute(['copy running-config startup-config']) + try: + self.execute(['copy running-config startup-config'], output='text') + except TypeError: + self.execute(['copy running-config startup-config']) def load_checkpoint(self, checkpoint): try: