lib/consul/async/consul_template.rb in consul-templaterb-1.26.0 vs lib/consul/async/consul_template.rb in consul-templaterb-1.26.1
- old
+ new
@@ -51,21 +51,21 @@
def datacenters(dc: nil, agent: nil)
path = '/v1/coordinate/datacenters'
query_params = {}
query_params[:dc] = dc if dc
@endp_manager.create_if_missing(path, query_params, agent: agent) do
- ConsulTemplateNodes.new(ConsulEndpoint.new(@endp_manager.consul_conf, path, true, query_params, '[]', agent: agent))
+ ConsulTemplateNodes.new(ConsulEndpoint.new(@endp_manager.consul_conf, path, true, query_params, '[]', agent))
end
end
# Returns the coordinates for all nodes of DC
def nodes(dc: nil, agent: nil)
path = '/v1/coordinate/nodes'
query_params = {}
query_params[:dc] = dc if dc
@endp_manager.create_if_missing(path, query_params, agent: agent) do
- ConsulTemplateNodes.new(ConsulEndpoint.new(@endp_manager.consul_conf, path, true, query_params, '[]', agent: agent))
+ ConsulTemplateNodes.new(ConsulEndpoint.new(@endp_manager.consul_conf, path, true, query_params, '[]', agent))
end
end
# Computes the RTT between 2 nodes
def rtt(a, b)
@@ -134,74 +134,74 @@
path = "/v1/health/service/#{name}"
query_params = {}
query_params[:dc] = dc if dc
query_params[:passing] = passing if passing
query_params[:tag] = tag if tag
- create_if_missing(path, query_params, agent: agent) { ConsulTemplateService.new(ConsulEndpoint.new(consul_conf, path, true, query_params, '[]')) }
+ create_if_missing(path, query_params, agent: agent) { ConsulTemplateService.new(ConsulEndpoint.new(consul_conf, path, true, query_params, '[]', agent)) }
end
# https://www.consul.io/api/health.html#list-checks-for-service
def checks_for_service(name, dc: nil, passing: false, agent: nil)
raise 'You must specify a name for a service' if name.nil?
path = "/v1/health/checks/#{name}"
query_params = {}
query_params[:dc] = dc if dc
query_params[:passing] = passing if passing
- create_if_missing(path, query_params, agent: agent) { ConsulTemplateChecks.new(ConsulEndpoint.new(consul_conf, path, true, query_params, '[]')) }
+ create_if_missing(path, query_params, agent: agent) { ConsulTemplateChecks.new(ConsulEndpoint.new(consul_conf, path, true, query_params, '[]', agent)) }
end
# https://www.consul.io/api/health.html#list-checks-for-node
def checks_for_node(name, dc: nil, passing: false, agent: nil)
raise 'You must specify a name for a service' if name.nil?
path = "/v1/health/node/#{name}"
query_params = {}
query_params[:dc] = dc if dc
query_params[:passing] = passing if passing
- create_if_missing(path, query_params, agent: agent) { ConsulTemplateChecks.new(ConsulEndpoint.new(consul_conf, path, true, query_params, '[]')) }
+ create_if_missing(path, query_params, agent: agent) { ConsulTemplateChecks.new(ConsulEndpoint.new(consul_conf, path, true, query_params, '[]', agent)) }
end
# https://www.consul.io/api/catalog.html#list-nodes
def nodes(dc: nil, agent: nil)
path = '/v1/catalog/nodes'
query_params = {}
query_params[:dc] = dc if dc
- create_if_missing(path, query_params, agent: agent) { ConsulTemplateNodes.new(ConsulEndpoint.new(consul_conf, path, true, query_params, '[]')) }
+ create_if_missing(path, query_params, agent: agent) { ConsulTemplateNodes.new(ConsulEndpoint.new(consul_conf, path, true, query_params, '[]', agent)) }
end
# https://www.consul.io/api/catalog.html#list-services-for-node
def node(name_or_id, dc: nil, agent: nil)
path = "/v1/catalog/node/#{name_or_id}"
query_params = {}
query_params[:dc] = dc if dc
- create_if_missing(path, query_params, agent: agent) { ConsulTemplateNodes.new(ConsulEndpoint.new(consul_conf, path, true, query_params, '{}')) }
+ create_if_missing(path, query_params, agent: agent) { ConsulTemplateNodes.new(ConsulEndpoint.new(consul_conf, path, true, query_params, '{}', agent)) }
end
# https://www.consul.io/api/agent.html#read-configuration
def agent_self(agent: nil)
path = '/v1/agent/self'
query_params = {}
default_value = '{"Config":{}, "Coord":{}, "Member":{}, "Meta":{}, "Stats":{}}'
- create_if_missing(path, query_params, agent: agent) { ConsulAgentSelf.new(ConsulEndpoint.new(consul_conf, path, true, query_params, default_value)) }
+ create_if_missing(path, query_params, agent: agent) { ConsulAgentSelf.new(ConsulEndpoint.new(consul_conf, path, true, query_params, default_value, agent)) }
end
# https://www.consul.io/api/agent.html#view-metrics
def agent_metrics(agent: nil)
path = '/v1/agent/metrics'
query_params = {}
default_value = '{"Gauges":[], "Points":[], "Member":{}, "Counters":[], "Samples":{}}'
- create_if_missing(path, query_params, agent: agent) { ConsulAgentMetrics.new(ConsulEndpoint.new(consul_conf, path, true, query_params, default_value)) }
+ create_if_missing(path, query_params, agent: agent) { ConsulAgentMetrics.new(ConsulEndpoint.new(consul_conf, path, true, query_params, default_value, agent)) }
end
# https://www.consul.io/api/agent.html#list-members
def agent_members(wan: false, agent: nil)
path = '/v1/agent/members'
query_params = {}
query_params['wan'] = true if wan
default_value = '[]'
- create_if_missing(path, query_params, agent: agent) { ConsulTemplateMembers.new(ConsulEndpoint.new(consul_conf, path, true, query_params, default_value)) }
+ create_if_missing(path, query_params, agent: agent) { ConsulTemplateMembers.new(ConsulEndpoint.new(consul_conf, path, true, query_params, default_value, agent)) }
end
# Return a param of template
def param(key, default_value = nil)
v = @context[:params][key]
@@ -220,28 +220,28 @@
path = '/v1/catalog/services'
query_params = {}
query_params[:dc] = dc if dc
# Tag filtering is performed on client side
query_params[:tag] = tag if tag
- create_if_missing(path, query_params, agent: agent) { ConsulTemplateServices.new(ConsulEndpoint.new(consul_conf, path, true, query_params, '{}')) }
+ create_if_missing(path, query_params, agent: agent) { ConsulTemplateServices.new(ConsulEndpoint.new(consul_conf, path, true, query_params, '{}', agent)) }
end
# https://www.consul.io/api/catalog.html#list-datacenters
def datacenters(agent: nil)
path = '/v1/catalog/datacenters'
query_params = {}
- create_if_missing(path, query_params, agent: agent) { ConsulTemplateDatacenters.new(ConsulEndpoint.new(consul_conf, path, true, query_params, '[]')) }
+ create_if_missing(path, query_params, agent: agent) { ConsulTemplateDatacenters.new(ConsulEndpoint.new(consul_conf, path, true, query_params, '[]', agent)) }
end
# https://www.consul.io/api/kv.html#read-key
def kv(name = nil, dc: nil, keys: nil, recurse: false, agent: nil)
path = "/v1/kv/#{name}"
query_params = {}
query_params[:dc] = dc if dc
query_params[:recurse] = recurse if recurse
query_params[:keys] = keys if keys
default_value = '[]'
- create_if_missing(path, query_params, agent: agent) { ConsulTemplateKV.new(ConsulEndpoint.new(consul_conf, path, true, query_params, default_value), name) }
+ create_if_missing(path, query_params, agent: agent) { ConsulTemplateKV.new(ConsulEndpoint.new(consul_conf, path, true, query_params, default_value, agent), name) }
end
def secrets(path = '', agent: nil)
raise "You need to provide a vault token to use 'secret' keyword" if vault_conf.token.nil?