From 992a12a76cc8599db56c506bcb86607be383fa66 Mon Sep 17 00:00:00 2001 From: Federico Capoano Date: Wed, 17 Apr 2024 12:07:04 -0400 Subject: [PATCH] [change] DeviceConnection.update_config will not flag as applied DeviceConnection.update_config used to report the config as applied automatically, but this can potentially lead to inconsistencies. The config applied status is reported by the openwisp agent once the config has been applied successfully. --- openwisp_controller/connection/base/models.py | 1 - openwisp_controller/connection/tests/test_models.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/openwisp_controller/connection/base/models.py b/openwisp_controller/connection/base/models.py index 2ccd1ae45..66452fc4a 100644 --- a/openwisp_controller/connection/base/models.py +++ b/openwisp_controller/connection/base/models.py @@ -368,7 +368,6 @@ def update_config(self): except Exception as e: logger.exception(e) else: - self.device.config.set_status_applied() self.disconnect() def save(self, *args, **kwargs): diff --git a/openwisp_controller/connection/tests/test_models.py b/openwisp_controller/connection/tests/test_models.py index 5c7243e5b..ca1d10bfa 100644 --- a/openwisp_controller/connection/tests/test_models.py +++ b/openwisp_controller/connection/tests/test_models.py @@ -928,7 +928,7 @@ def _assert_applying_conf_test_command(mocked_exec): args, _ = mocked_exec_command.call_args_list[1] self.assertIn('OW_CONFIG_PID', args[0]) conf.refresh_from_db() - self.assertEqual(conf.status, 'applied') + self.assertEqual(conf.status, 'modified') with self.subTest('openwisp_config < 0.6.0a: exit_code 0'): conf.config = '{"interfaces": [{"name": "eth00","type": "ethernet"}]}' @@ -942,7 +942,7 @@ def _assert_applying_conf_test_command(mocked_exec): _assert_version_check_command(mocked_exec_command) _assert_applying_conf_test_command(mocked_exec_command) conf.refresh_from_db() - self.assertEqual(conf.status, 'applied') + self.assertEqual(conf.status, 'modified') with self.subTest('openwisp_config < 0.6.0a: exit_code 1'): conf.config = '{"radios": []}'