X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/cf1dcfb8715822f7ac5fe4fce067197dd84bad54..a6fd7801f084f280cbf668f8a1f6bf9d9bbd0def:/services/api/app/models/node.rb diff --git a/services/api/app/models/node.rb b/services/api/app/models/node.rb index 044d83c287..c8b463696b 100644 --- a/services/api/app/models/node.rb +++ b/services/api/app/models/node.rb @@ -39,7 +39,7 @@ class Node < ArvadosModel api_accessible :superuser, :extend => :user do |t| t.add :first_ping_at t.add :info - t.add lambda { |x| Rails.configuration.Containers.SLURM.Managed.ComputeNodeNameservers }, :as => :nameservers + t.add lambda { |x| Rails.configuration.Containers.SLURM.Managed.ComputeNodeNameservers.keys }, :as => :nameservers end after_initialize do @@ -168,7 +168,7 @@ class Node < ArvadosModel end def dns_server_update - if ip_address_changed? && ip_address + if saved_change_to_ip_address? && ip_address Node.where('id != ? and ip_address = ?', id, ip_address).each do |stale_node| # One or more(!) stale node records have the same IP address @@ -178,10 +178,10 @@ class Node < ArvadosModel stale_node.update_attributes!(ip_address: nil) end end - if hostname_was && hostname_changed? - self.class.dns_server_update(hostname_was, UNUSED_NODE_IP) + if hostname_before_last_save && saved_change_to_hostname? + self.class.dns_server_update(hostname_before_last_save, UNUSED_NODE_IP) end - if hostname && (hostname_changed? || ip_address_changed?) + if hostname && (saved_change_to_hostname? || saved_change_to_ip_address?) self.class.dns_server_update(hostname, ip_address || UNUSED_NODE_IP) end end