Skip to content

Commit

Permalink
Fix action description adn error appearing when it shouldn't
Browse files Browse the repository at this point in the history
  • Loading branch information
hipek8 committed Mar 4, 2025
1 parent 9d8a37d commit 3b79521
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ralph/data_center/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/ralph/data_center/admin_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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")
Expand Down

0 comments on commit 3b79521

Please sign in to comment.