Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix action description adn error appearing when it shouldn't #3885

Merged
merged 3 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/ralph/data_center/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ 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
Loading