From 3b795214bb49bbdaf3e96939a56a32acefa6519c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Szulc?= Date: Tue, 4 Mar 2025 08:50:54 +0100 Subject: [PATCH 1/3] Fix action description adn error appearing when it shouldn't --- src/ralph/data_center/admin.py | 1 + src/ralph/data_center/admin_actions.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/ralph/data_center/admin.py b/src/ralph/data_center/admin.py index bc1f614c5c..131911514a 100644 --- a/src/ralph/data_center/admin.py +++ b/src/ralph/data_center/admin.py @@ -555,6 +555,7 @@ class DataCenterAssetAdmin( def assign_mgmt_hostname(self, *args, **kwargs): return assign_management_hostname_and_ip(self, *args, **kwargs) + assign_mgmt_hostname.short_description = "Assign management hostname and IP" def get_export_queryset(self, request): qs = ( super(RalphAdminImportExportMixin, self) diff --git a/src/ralph/data_center/admin_actions.py b/src/ralph/data_center/admin_actions.py index 57259c6364..1e4d61fe0e 100644 --- a/src/ralph/data_center/admin_actions.py +++ b/src/ralph/data_center/admin_actions.py @@ -30,6 +30,7 @@ def assign_management_hostname_and_ip(modeladmin, request, queryset): modeladmin.message_user( request, f"Updated management hostname for asset id: {dca.id}", level="INFO" ) + continue else: ip = _infer_ip(dca, rack_number) # others (i.e. server rack) if ip: @@ -39,6 +40,7 @@ def assign_management_hostname_and_ip(modeladmin, request, queryset): request, f"Updated management hostname and IP for asset id: {dca.id}", level="INFO" ) + continue raise RuntimeError("unknown error") except Exception as e: # noqa modeladmin.message_user(request, f"Can't update asset id: {dca.id}: {e}", level="ERROR") From 5d9012de66a90f2df83c2aabd89077c5c6e10178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Szulc?= Date: Tue, 4 Mar 2025 09:00:38 +0100 Subject: [PATCH 2/3] Fix flae --- src/ralph/data_center/admin.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ralph/data_center/admin.py b/src/ralph/data_center/admin.py index 131911514a..304a9953dc 100644 --- a/src/ralph/data_center/admin.py +++ b/src/ralph/data_center/admin.py @@ -556,6 +556,7 @@ def assign_mgmt_hostname(self, *args, **kwargs): return assign_management_hostname_and_ip(self, *args, **kwargs) assign_mgmt_hostname.short_description = "Assign management hostname and IP" + def get_export_queryset(self, request): qs = ( super(RalphAdminImportExportMixin, self) From 29857ed20fae3d569efef69e886fc940833a1a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Szulc?= Date: Tue, 4 Mar 2025 09:11:14 +0100 Subject: [PATCH 3/3] Fix flake again --- src/ralph/data_center/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ralph/data_center/admin.py b/src/ralph/data_center/admin.py index 304a9953dc..618b927515 100644 --- a/src/ralph/data_center/admin.py +++ b/src/ralph/data_center/admin.py @@ -556,7 +556,7 @@ def assign_mgmt_hostname(self, *args, **kwargs): return assign_management_hostname_and_ip(self, *args, **kwargs) assign_mgmt_hostname.short_description = "Assign management hostname and IP" - + def get_export_queryset(self, request): qs = ( super(RalphAdminImportExportMixin, self)