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.
This commit is contained in:
parent
24c9e047c3
commit
2a908b832c
1 changed files with 12 additions and 0 deletions
|
@ -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…
Reference in a new issue