File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
openwisp_controller/connection Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -55,13 +55,24 @@ def update_config(self, device_id):
5555 return
5656 if _is_update_in_progress (device_id , current_task_id = self .request .id ):
5757 return
58+ device_conn = None
5859 try :
5960 device_conn = DeviceConnection .get_working_connection (device )
6061 except NoWorkingDeviceConnectionError :
6162 return
6263 else :
6364 logger .info (f"Updating { device } (pk: { device_id } )" )
64- device_conn .update_config ()
65+ try :
66+ device_conn .update_config ()
67+ except Exception as e :
68+ logger .error (f"update_config failed for device { device_id } : { e } " )
69+ raise
70+ finally :
71+ if device_conn :
72+ try :
73+ device_conn .close ()
74+ except Exception as close_err :
75+ logger .warning (f"Error closing connection: { close_err } " )
6576
6677
6778# task timeout is SSH_COMMAND_TIMEOUT plus a 20% margin
You can’t perform that action at this time.
0 commit comments