From d34f7c24d9c718af2b27303814b6c6ae016a8b79 Mon Sep 17 00:00:00 2001 From: d3justi Date: Sat, 17 Sep 2016 10:38:24 -0500 Subject: [PATCH] Fixed transport issues when calling self.execute from Cli --- lib/ansible/module_utils/nxos.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/ansible/module_utils/nxos.py b/lib/ansible/module_utils/nxos.py index 7ba3018317..058c0b946f 100644 --- a/lib/ansible/module_utils/nxos.py +++ b/lib/ansible/module_utils/nxos.py @@ -43,7 +43,10 @@ class NxapiConfigMixin(object): def load_config(self, config): checkpoint = 'ansible_%s' % int(time.time()) - self.execute(['checkpoint %s' % checkpoint], output='text') + try: + self.execute(['checkpoint %s' % checkpoint], output='text') + except TypeError: + self.execute(['checkpoint %s' % checkpoint]) try: self.configure(config) @@ -51,14 +54,21 @@ class NxapiConfigMixin(object): self.load_checkpoint(checkpoint) raise - self.execute(['no checkpoint %s' % checkpoint], output='text') + try: + self.execute(['no checkpoint %s' % checkpoint], output='text') + except TypeError: + self.execute(['no checkpoint %s' % checkpoint]) def save_config(self, **kwargs): self.execute(['copy running-config startup-config']) def load_checkpoint(self, checkpoint): - self.execute(['rollback running-config checkpoint %s' % checkpoint, - 'no checkpoint %s' % checkpoint], output='text') + try: + self.execute(['rollback running-config checkpoint %s' % checkpoint, + 'no checkpoint %s' % checkpoint], output='text') + except TypeError: + self.execute(['rollback running-config checkpoint %s' % checkpoint, + 'no checkpoint %s' % checkpoint]) class Nxapi(NxapiConfigMixin):