Skip to content

Commit 9554cc7

Browse files
authored
fix(networking): handle errors when fetching PTR records in floating_ips (#1888)
1 parent 6a1ab47 commit 9554cc7

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

plugins/networking/app/controllers/networking/floating_ips_controller.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ class FloatingIpsController < DashboardController
1212
def index
1313
per_page = params[:per_page] || 20
1414
@fip_ptr_records = []
15-
@fip_ptr_records = services.dns_service.list_floating_ips_ptr_records
15+
@fip_ptr_records = begin
16+
services.dns_service.list_floating_ips_ptr_records
17+
rescue StandardError => e
18+
logger.error("Error fetching floating IP PTR records: #{e.message}")
19+
[]
20+
end
21+
1622
@floating_ips =
1723
paginatable(per_page: per_page) do |pagination_options|
1824
services.networking.project_floating_ips(

plugins/networking/app/views/networking/floating_ips/_item.html.haml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
= floating_ip.floating_ip_address
99
- if floating_ip.subnet_object
1010
%span.info-text= " / #{floating_ip.subnet_object.name}"
11-
%br
12-
%small.info-text
13-
- if defined?(fip_ptr_record) && fip_ptr_record&.ptrdname.present?
14-
= fip_ptr_record.ptrdname
15-
- else
16-
- if floating_ip.dns_domain
17-
= "#{floating_ip.dns_name}.#{floating_ip.dns_domain}"
11+
12+
- if defined?(fip_ptr_record) && fip_ptr_record&.ptrdname.present?
13+
%br
14+
%small.info-text= fip_ptr_record.ptrdname
15+
- elsif floating_ip.dns_domain.present? && floating_ip.dns_name.present?
16+
%br
17+
%small.info-text= "#{floating_ip.dns_name}.#{floating_ip.dns_domain}"
18+
1819
%td
1920
- if floating_ip.fixed_ip_address.present?
2021
= link_to plugin('networking').floating_ip_path(floating_ip.id), data: {modal: true} do

0 commit comments

Comments
 (0)