Skip to content

Commit

Permalink
[change] DeviceConnection.update_config will not flag as applied
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nemesifier committed Apr 17, 2024
1 parent 2c58297 commit 992a12a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion openwisp_controller/connection/base/models.py
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions openwisp_controller/connection/tests/test_models.py
Expand Up @@ -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"}]}'
Expand All @@ -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": []}'
Expand Down

0 comments on commit 992a12a

Please sign in to comment.