5200: Enable anonymous file view/download.
[arvados.git] / services / api / app / models / node.rb
index 3bc25863e2e1ce4ad8d6fab49f63a4bcc8969789..c38f6817dbc768f4b380c51b999d75c6526dff61 100644 (file)
@@ -137,13 +137,15 @@ class Node < ArvadosModel
 
   def dns_server_update
     if self.hostname_changed? or self.ip_address_changed?
-      @stale_conflicting_nodes = Node.where('id != ? and ip_address = ? and last_ping_at < ?',self.id,self.ip_address,10.minutes.ago)
-      if not @stale_conflicting_nodes.empty?
-        # One or more stale compute node records have the same IP address as the new node.
-        # Clear the ip_address field on the stale nodes.
-        @stale_conflicting_nodes.each do |stale_node|
-          stale_node.ip_address = nil
-          stale_node.save!
+      if not self.ip_address.nil?
+        stale_conflicting_nodes = Node.where('id != ? and ip_address = ? and last_ping_at < ?',self.id,self.ip_address,10.minutes.ago)
+        if not stale_conflicting_nodes.empty?
+          # One or more stale compute node records have the same IP address as the new node.
+          # Clear the ip_address field on the stale nodes.
+          stale_conflicting_nodes.each do |stale_node|
+            stale_node.ip_address = nil
+            stale_node.save!
+          end
         end
       end
       if self.hostname and self.ip_address