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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29775148101ee7b5606bf8147c419def65765b13
4
- data.tar.gz: fe10a06b4db60f71fb8832d4b59d62a83c2e6c17
3
+ metadata.gz: 12238b218882f651e98130c984371e19718130c9
4
+ data.tar.gz: a4c23d1276e08d7c2ffaa712f4520d75e88b2c5a
5
5
  SHA512:
6
- metadata.gz: ba1cc8948844efbc746b227791f349210494ff9a4c9a21ebbc8a722eccf09fb8e7b9c4f203eee3cab2ad8161b74e94f34a673ad673e4d58b33ed06e520648d2e
7
- data.tar.gz: b62e6e914f5696c5806dd1f0befe0713ffed69d95bc5cd6e88c7942ecb53fb0ac68672117dffeb5431d85cd96c3f60c462ab165a50658aeec199a02d1a86576d
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], normal: attributes)
174
+ registry[:node_resource].new(name: item[:data][chef_id], automatic: attributes)
163
175
  end
164
176
  else
165
177
  response[:rows]
@@ -1,3 +1,3 @@
1
1
  module Ridley
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ridley
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Winsor