lib/services/connection.rb in jn_services-1.0.2 vs lib/services/connection.rb in jn_services-1.0.3
- old
+ new
@@ -32,10 +32,11 @@
@run_context = args.fetch(:run_context, nil)
Services.run_context = args[:run_context]
@node = args[:run_context].node if run_context
@host = args[:host]
@port = args[:port] || 4001
+ @redirect = args[:redirect] || false
@ssl_verify = args[:verify] || OpenSSL::SSL::VERIFY_NONE
validate
load_gem
Services.connection = get_connection(find_servers)
@@ -133,10 +134,10 @@
# Try to grab an etcd connection
#
# @param [String] server () The server to try to connect too
#
def try_connect(server)
- c = ::Etcd.client(host: server, port: port)
+ c = ::Etcd.client(host: server, port: port, allow_redirect: @redirect)
begin
c.get '/_etcd/machines'
return c
rescue
puts "ETCD: failed to connect to #{c.host}:#{c.port}"