Skip to content

Commit ab825a9

Browse files
samuel-gauthierrjarry
authored andcommitted
subscription: fix extra_info exception
There are cases when the extra_info can not be filled, for instance when the originator is not netopeer2. Send dummy values in this case. Signed-off-by: Samuel Gauthier <[email protected]>
1 parent 2ff8b5b commit ab825a9

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

sysrepo/subscription.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,16 @@ def module_change_callback(session, sub_id, module, xpath, event, req_id, priv):
229229
private_data = subscription.private_data
230230
event_name = EVENT_NAMES[event]
231231
if subscription.extra_info:
232-
extra_info = {
233-
"netconf_id": session.get_netconf_id(),
234-
"user": session.get_user(),
235-
}
232+
try:
233+
extra_info = {
234+
"netconf_id": session.get_netconf_id(),
235+
"user": session.get_user(),
236+
}
237+
except SysrepoError:
238+
extra_info = {
239+
"netconf_id": -1,
240+
"user": "",
241+
}
236242
else:
237243
extra_info = {}
238244

0 commit comments

Comments
 (0)