[ARVADOS] updated: 2105942b856ac9621c2887f9e86636b4d7f17a14
Git user
git at public.curoverse.com
Fri Nov 4 17:53:36 EDT 2016
Summary of changes:
services/api/app/models/node.rb | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
via 2105942b856ac9621c2887f9e86636b4d7f17a14 (commit)
from 8e56df8796bf822e6c5181d80715a3a217320696 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 2105942b856ac9621c2887f9e86636b4d7f17a14
Author: Tom Clegg <tom at curoverse.com>
Date: Fri Nov 4 17:53:33 2016 -0400
10459: Tidy up some verbose code.
diff --git a/services/api/app/models/node.rb b/services/api/app/models/node.rb
index 97ffcba..e470e4c 100644
--- a/services/api/app/models/node.rb
+++ b/services/api/app/models/node.rb
@@ -138,16 +138,15 @@ class Node < ArvadosModel
if hostname_changed? && hostname_was
self.class.dns_server_update(hostname_was, UNUSED_NODE_IP)
end
- if self.hostname_changed? or self.ip_address_changed?
- 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
+ if hostname_changed? or ip_address_changed?
+ if ip_address
+ Node.where('id != ? and ip_address = ? and last_ping_at < ?',
+ id, ip_address, 10.minutes.ago).each do |stale_node|
+ # 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_node.ip_address = nil
+ stale_node.save!
end
end
if hostname
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list