From 10b532c688edd0bee78b8155568644ff41286b3e Mon Sep 17 00:00:00 2001 From: Matias Bordese Date: Mon, 14 Oct 2024 10:34:33 -0300 Subject: [PATCH] Fix irm enabled organization sync setting (#5174) Check the right settings when enabling/disabling the irm plugin. --- engine/apps/user_management/sync.py | 2 +- engine/apps/user_management/tests/test_sync.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/apps/user_management/sync.py b/engine/apps/user_management/sync.py index d94edd371..8bf60c6d2 100644 --- a/engine/apps/user_management/sync.py +++ b/engine/apps/user_management/sync.py @@ -71,7 +71,7 @@ def _sync_organization(organization: Organization) -> None: # get IRM plugin settings is_grafana_irm_enabled = False - grafana_irm_plugin_settings, _ = grafana_api_client.get_grafana_labels_plugin_settings() + grafana_irm_plugin_settings, _ = grafana_api_client.get_grafana_irm_plugin_settings() if grafana_irm_plugin_settings is not None: is_grafana_irm_enabled = grafana_irm_plugin_settings["enabled"] diff --git a/engine/apps/user_management/tests/test_sync.py b/engine/apps/user_management/tests/test_sync.py index d1c63bbd0..e381c62a4 100644 --- a/engine/apps/user_management/tests/test_sync.py +++ b/engine/apps/user_management/tests/test_sync.py @@ -68,6 +68,10 @@ def patched_grafana_api_client(organization, is_rbac_enabled_for_organization=(F ], None, ) + mock_client_instance.get_grafana_irm_plugin_settings.return_value = ( + {"enabled": False, "jsonData": {}}, + None, + ) mock_client_instance.get_grafana_incident_plugin_settings.return_value = ( {"enabled": True, "jsonData": {GRAFANA_INCIDENT_PLUGIN_BACKEND_URL_KEY: MOCK_GRAFANA_INCIDENT_BACKEND_URL}}, None,