Skip to content

Commit

Permalink
Merge pull request Juniper#490 from fooelisa/timeout-error
Browse files Browse the repository at this point in the history
catching RpcTimeoutError, ConnectClosedError in open_configuration
  • Loading branch information
vnitinv committed Apr 5, 2016
2 parents 342d00f + 74d4985 commit 4559cb7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/jnpr/junos/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,8 @@ def __enter__(self):
def _open_configuration_private():
try:
self.rpc.open_configuration(private=True)
except (RpcTimeoutError, ConnectClosedError) as err:
raise err
except RpcError as err:
if err.rpc_error['severity'] == 'warning':
if err.message != 'uncommitted changes will be discarded on exit':
Expand All @@ -649,12 +651,17 @@ def _open_configuration_private():
raise err

def _open_configuration_dynamic():
self.rpc.open_configuration(dynamic=True)
try:
self.rpc.open_configuration(dynamic=True)
except RpcError as err:
raise err
return True

def _open_configuration_batch():
try:
self.rpc.open_configuration(batch=True)
except (RpcTimeoutError, ConnectClosedError) as err:
raise err
except RpcError as err:
if err.rpc_error['severity'] == 'warning':
if err.message != 'uncommitted changes will be discarded on exit':
Expand Down

0 comments on commit 4559cb7

Please sign in to comment.