We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 45b24b6 commit 762ae3cCopy full SHA for 762ae3c
1 file changed
openwisp_controller/connection/tasks.py
@@ -60,8 +60,23 @@ def update_config(self, device_id):
60
except NoWorkingDeviceConnectionError:
61
return
62
else:
63
- logger.info(f"Updating {device} (pk: {device_id})")
+ logger.info(f"Updating {device} (pk: {device_id})")
64
+
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
+ # ensure connection is closed
72
+ close_method = getattr(device_conn, "close", None)
73
+if callable(close_method):
74
75
+ close_method()
76
77
+ device_conn.close()
78
+ except Exception as close_err:
79
+ logger.warning(f"Error closing connection: {close_err}")
80
81
82
# task timeout is SSH_COMMAND_TIMEOUT plus a 20% margin
0 commit comments