ridley 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ridley/chef_objects/node_object.rb +2 -2
- data/lib/ridley/resources/search_resource.rb +20 -8
- data/lib/ridley/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12238b218882f651e98130c984371e19718130c9
|
4
|
+
data.tar.gz: a4c23d1276e08d7c2ffaa712f4520d75e88b2c5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4c44d05cd85d33218960192dc3071a83392415a20be96ed4e59d086a63b182c358e0acb69515c06aedabdf9ff58a843b3c87b69f3dddad7eca718a6f175a359
|
7
|
+
data.tar.gz: 9375cd35216860793a56df9eef360508c4497d2d806458c549c36318bf425c591619c70a72df29a5679fffbd3b9075c55c1e6b6b9072cef360b63af1966ebfda
|
@@ -67,7 +67,7 @@ module Ridley
|
|
67
67
|
#
|
68
68
|
# @return [String]
|
69
69
|
def public_hostname
|
70
|
-
self.cloud? ? self.automatic[:cloud][:public_hostname] : self.automatic[:fqdn]
|
70
|
+
self.cloud? ? self.automatic[:cloud][:public_hostname] || self.automatic[:fqdn] : self.automatic[:fqdn]
|
71
71
|
end
|
72
72
|
|
73
73
|
# Returns the public IPv4 address of the instantiated node. This ip address should be
|
@@ -78,7 +78,7 @@ module Ridley
|
|
78
78
|
#
|
79
79
|
# @return [String]
|
80
80
|
def public_ipv4
|
81
|
-
self.cloud? ? self.automatic[:cloud][:public_ipv4] : self.automatic[:ipaddress]
|
81
|
+
self.cloud? ? self.automatic[:cloud][:public_ipv4] || self.automatic[:ipaddress] : self.automatic[:ipaddress]
|
82
82
|
end
|
83
83
|
alias_method :public_ipaddress, :public_ipv4
|
84
84
|
|
@@ -131,19 +131,31 @@ module Ridley
|
|
131
131
|
def partial(index, query_string, attributes, resources_registry, options = {})
|
132
132
|
query_uri = self.class.query_uri(index)
|
133
133
|
param_string = self.class.build_param_string(query_string, options)
|
134
|
-
|
135
|
-
chef_id = chef_id_for_index(index)
|
136
|
-
|
137
|
-
body = Hash.new.tap do |body|
|
138
|
-
body[chef_id] = [ chef_id ] if chef_id
|
139
|
-
attributes.collect { |attr| body[attr] = attr.split('.') }
|
140
|
-
end
|
134
|
+
body = build_partial_body(index, attributes)
|
141
135
|
|
142
136
|
handle_partial(index, resources_registry, request(:post, "#{query_uri}#{param_string}", JSON.generate(body)))
|
143
137
|
end
|
144
138
|
|
145
139
|
private
|
146
140
|
|
141
|
+
def build_partial_body(index, attributes)
|
142
|
+
chef_id = chef_id_for_index(index)
|
143
|
+
|
144
|
+
Hash.new.tap do |body|
|
145
|
+
body[chef_id] = [ chef_id ] if chef_id
|
146
|
+
|
147
|
+
if index.to_sym == :node
|
148
|
+
body['cloud.public_hostname'] = [ 'cloud', 'public_hostname' ]
|
149
|
+
body['cloud.public_ip4v'] = [ 'cloud', 'public_ip4v' ]
|
150
|
+
body['cloud.provider'] = [ 'cloud', 'provider' ]
|
151
|
+
body['fqdn'] = [ 'fqdn' ]
|
152
|
+
body['ipaddress'] = [ 'ipaddress' ]
|
153
|
+
end
|
154
|
+
|
155
|
+
attributes.collect { |attr| body[attr] = attr.split('.') }
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
147
159
|
def chef_id_for_index(index)
|
148
160
|
chef_id = index.to_sym == :node ? Ridley::NodeObject.chef_id : nil
|
149
161
|
end
|
@@ -159,7 +171,7 @@ module Ridley
|
|
159
171
|
next if key.to_s == chef_id.to_s
|
160
172
|
attributes.deep_merge!(Hash.from_dotted_path(key, value))
|
161
173
|
end
|
162
|
-
registry[:node_resource].new(name: item[:data][chef_id],
|
174
|
+
registry[:node_resource].new(name: item[:data][chef_id], automatic: attributes)
|
163
175
|
end
|
164
176
|
else
|
165
177
|
response[:rows]
|
data/lib/ridley/version.rb
CHANGED