Class: Serverspec::Type::ConsulNode
Instance Method Summary
collapse
Methods inherited from ConsulBase
#[], #initialize
Methods inherited from ApiBase
#[], #initialize
Instance Method Details
#datacenter ⇒ Object
16
17
18
|
# File 'lib/serverspec_extra_types/types/consul_node.rb', line 16
def datacenter
inspection['Node']['Datacenter']
end
|
#has_datacenter?(dc) ⇒ Boolean
12
13
14
|
# File 'lib/serverspec_extra_types/types/consul_node.rb', line 12
def has_datacenter?(dc)
datacenter == dc
end
|
#has_service?(service_name) ⇒ Boolean
20
21
22
|
# File 'lib/serverspec_extra_types/types/consul_node.rb', line 20
def has_service?(service_name)
service(service_name) != nil
end
|
#inspection ⇒ Object
32
33
34
|
# File 'lib/serverspec_extra_types/types/consul_node.rb', line 32
def inspection
@inspection ||= ::MultiJson.load(get_inspection.stdout)
end
|
#service(service_name) ⇒ Object
24
25
26
|
# File 'lib/serverspec_extra_types/types/consul_node.rb', line 24
def service(service_name)
services.find service_name
end
|
#services ⇒ Object
28
29
30
|
# File 'lib/serverspec_extra_types/types/consul_node.rb', line 28
def services
inspection['Services']
end
|
#url ⇒ Object
8
9
10
|
# File 'lib/serverspec_extra_types/types/consul_node.rb', line 8
def url
"#{@url_base}/v1/catalog/node/#{@name}"
end
|