lib/skalera/services/controllers.rb in skalera-services-0.2.3 vs lib/skalera/services/controllers.rb in skalera-services-0.2.4
- old
+ new
@@ -6,9 +6,11 @@
def self.for(controller_uuid)
controllers = Diplomat::Kv.get("controllers/#{controller_uuid}", recurse: true)
host = extract(controllers, 'address')
port = extract(controllers, 'port')
[host['address'], port['port']]
+ rescue Diplomat::KeyNotFound
+ STDERR.puts "ERROR: key not found: controllers/#{controller_uuid}"
end
def self.extract(controllers, field)
result = {}
controllers.select { |c| c[:key].match(%r{/#{field}}) }.each do |hash|