fixes commit confirm check in junos shared module (#17663)

The module didn't perform a commit confirm check which would cause
checking commits to be non idempotent.  This change will fix that problem.
pull/17647/head
Peter Sprygada 8 years ago committed by GitHub
parent 24c9e047c3
commit 2a908b832c

@ -236,6 +236,18 @@ class Netconf(object):
exc = get_exception() exc = get_exception()
raise NetworkError('unable to commit config: %s' % str(exc)) raise NetworkError('unable to commit config: %s' % str(exc))
def confirm_commit(self, checkonly=False):
try:
resp = self.rpc('get_commit_information')
needs_confirm = 'commit confirmed, rollback' in resp[0][4].text
if checkonly:
return needs_confirm
return self.commit_config()
except IndexError:
# if there is no comment tag, the system is not in a commit
# confirmed state so just return
pass
def rollback_config(self, identifier, commit=True, comment=None): def rollback_config(self, identifier, commit=True, comment=None):
self.lock_config() self.lock_config()

Loading…
Cancel
Save