Skip to content

Commit

Permalink
[req-changes] Renamed methods
Browse files Browse the repository at this point in the history
  • Loading branch information
pandafy committed Nov 23, 2023
1 parent 0e69c6e commit 1fe816f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions openwisp_monitoring/device/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def connect_device_signals(self):
post_save.connect(
self.organization_post_save_receiver,
sender=Organization,
dispatch_uid='post_save_organization_clear_management_ip_monitoring_status',
dispatch_uid='post_save_organization_disabled_monitoring',
)

@classmethod
Expand All @@ -143,9 +143,9 @@ def device_post_delete_receiver(cls, instance, **kwargs):
@classmethod
def organization_post_save_receiver(cls, instance, *args, **kwargs):
if instance.is_active is False:
from .tasks import organization_disabled_handler
from .tasks import handle_disabled_organization

organization_disabled_handler.delay(str(instance.id))
handle_disabled_organization.delay(str(instance.id))

def device_recovery_detection(self):
if not app_settings.DEVICE_RECOVERY_DETECTION:
Expand Down
2 changes: 1 addition & 1 deletion openwisp_monitoring/device/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def is_metric_critical(metric):
return False

@classmethod
def organization_disabled_handler(cls, organization_id):
def handle_disabled_organization(cls, organization_id):
"""
Clears the management IP of all devices belonging to a
disabled organization and set their monitoring status to 'unknown'.
Expand Down
4 changes: 2 additions & 2 deletions openwisp_monitoring/device/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ def write_device_metrics(pk, data, time=None, current=False):


@shared_task(base=OpenwispCeleryTask)
def organization_disabled_handler(organization_id):
def handle_disabled_organization(organization_id):
DeviceMonitoring = load_model('device_monitoring', 'DeviceMonitoring')
DeviceMonitoring.organization_disabled_handler(organization_id)
DeviceMonitoring.handle_disabled_organization(organization_id)
2 changes: 1 addition & 1 deletion openwisp_monitoring/device/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ def test_deleting_device_deletes_tsdb(self):
self.assertEqual(self._read_metric(ping1), [])
self.assertNotEqual(self._read_metric(ping2), [])

def test_organization_disabled_handler(self):
def test_handle_disabled_organization(self):
device_monitoring, _, _, _ = self._create_env()
device = device_monitoring.device
device.management_ip = '10.10.0.5'
Expand Down

0 comments on commit 1fe816f

Please sign in to comment.