class Serverspec::Type::ConsulBase
Public Class Methods
new(name = nil, acl_token = nil, options = {})
click to toggle source
Calls superclass method
Serverspec::Type::ApiBase::new
# File lib/serverspec_extra_types/types/consul_base.rb, line 11 def initialize(name = nil, acl_token = nil, options = {}) super(name, options) @token = acl_token @url_base = property[:variables][:consul_url] || 'http://localhost:8500' end
Public Instance Methods
[](key)
click to toggle source
# File lib/serverspec_extra_types/types/consul_base.rb, line 17 def [](key) value = inspection key.split('.').each do |k| is_index = k.start_with?('[') && k.end_with?(']') value = value[is_index ? k[1..-2].to_i : k] end value end
inspection()
click to toggle source
# File lib/serverspec_extra_types/types/consul_base.rb, line 30 def inspection puts get_inspection.stdout puts get_inspection.stderr @inspection ||= ::MultiJson.load(get_inspection.stdout)[0] end
url()
click to toggle source
# File lib/serverspec_extra_types/types/consul_base.rb, line 26 def url @url_base end
Private Instance Methods
extra_args()
click to toggle source
# File lib/serverspec_extra_types/types/consul_base.rb, line 38 def extra_args @token ? "--header 'X-Consul-Token: #{@token}'" : '' end
get_inspection()
click to toggle source
rubocop:disable Naming/AccessorMethodName
# File lib/serverspec_extra_types/types/consul_base.rb, line 43 def get_inspection command = curl_command @get_inspection ||= @runner.run_command(command) end