mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 20:43:02 +02:00
Merge pull request #1257 from kernelkit/test-netconf
Fix NETCONF backend in Infamy to propagate RPC errors [skip ci]
This commit is contained in:
@@ -297,14 +297,21 @@ class Device(Transport):
|
||||
xml = xml.replace(f"yang:operation=\"{src}\"",
|
||||
f"nc:operation=\"{dst}\"" if dst else "")
|
||||
|
||||
last_error = None
|
||||
for _ in range(0, 3):
|
||||
try:
|
||||
self.ncc.edit_config(xml, default_operation='merge')
|
||||
last_error = None
|
||||
break
|
||||
except RpcError as _e:
|
||||
last_error = _e
|
||||
print(f"Failed sending edit-config RPC: {_e} Retrying ...")
|
||||
time.sleep(1)
|
||||
continue
|
||||
break
|
||||
|
||||
# If we exhausted all retries, raise the last error
|
||||
if last_error is not None:
|
||||
raise last_error
|
||||
|
||||
def put_config_dicts(self, models):
|
||||
"""PUT full configuration of all models to running-config"""
|
||||
|
||||
Reference in New Issue
Block a user