summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Sprygada <privateip@users.noreply.github.com>2016-09-18 22:24:01 -0400
committerGitHub <noreply@github.com>2016-09-18 22:24:01 -0400
commit79d1b51dfb57ed6c15d8b414a8ef257d583afc08 (patch)
treeaf60eb69147871a41a12c40fe3c92a13dcead9d2
parentfa5f8a75433fa3d10d55da52efba34d1f653fdda (diff)
parent261666a01bc36bf176ba90b812bec9d2727e4596 (diff)
downloadansible-79d1b51dfb57ed6c15d8b414a8ef257d583afc08.tar.gz
Merge pull request #17623 from dgjustice/nxos_fixes
Fixed transport issues when calling self.execute from Cli
-rw-r--r--lib/ansible/module_utils/nxos.py18
1 files 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):