rancher-metadata 0.17.11 → 0.17.12

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: 06a398d8834679e63072d85092638191281d1591
4
- data.tar.gz: db28350fa5170a9824f104aebab069964979a4c1
3
+ metadata.gz: 626665a97ead5093041e9aaaf59b1c99a39cc015
4
+ data.tar.gz: bb9c92d332502485c99bc01ffc007f1e1ed24c5a
5
5
  SHA512:
6
- metadata.gz: 1b8c126333e6789a1bd27090f8b63ca8136ad4322257601198c20ef730cfae8a717d99aa6806c4a09c4f36085516e999b5eb7a212bf89842a36d045360290ed4
7
- data.tar.gz: bf78c2787050884ab9d3b72aaab7c56b006899eb28531a471d9690774071d283383aebfb4e73f1b6c7caa24b547826c822d80eec65e847f119e3d00f8f13ed32
6
+ metadata.gz: 0f75b2e64d1f16acecf84166dfec0e8d24bae7adebb921f56f65d46e1974ae455418ea525e735ef981b469143cf0201049f3d257f1a2983532bd3bb4bf318684
7
+ data.tar.gz: fadf695e79741f1f15cdb1a08863378ecec69c4c7e56025e7d7e741eab72fdcfc34e7ff278a406c7baef1f5c83cbe959b8a8305c611abc8d145113ccf125deff
data/README.md CHANGED
@@ -16,14 +16,14 @@ require 'rancher-metadata'
16
16
  api = RancherMetadata::API.new({:api_url => "http://rancher-metadata/2015-12-19"})
17
17
 
18
18
  puts("Container create index: #{api.get_container_create_index}")
19
- puts("Container service suffix: #{api.get_container_service_suffix}")
19
+ puts("Container service index: #{api.get_container_service_index}")
20
20
  puts("Container ip: #{api.get_container_ip}")
21
21
  puts("Container name: #{api.get_container_name}")
22
22
  puts("Container service name: #{api.get_container_service_name}")
23
23
  puts("Container hostname: #{api.get_container_hostname}")
24
24
 
25
25
  api.wait_service_containers do |name, container|
26
- puts("Container #{name} is up (ip: #{container['primary_ip']}, create index: #{container['create_index']}, service suffix: #{container['service_suffix']})")
26
+ puts("Container #{name} is up (ip: #{container['primary_ip']}, create index: #{container['create_index']}, service index: #{container['service_index']})")
27
27
  end
28
28
 
29
29
  metadata = api.get_service_metadata
@@ -90,24 +90,24 @@ Look up a specific service running in another stack:
90
90
  puts(api.get_service({:service_name => 'my_service', :stack_name => 'my_stack'}).inspect)
91
91
  ```
92
92
 
93
- look up the current service's containers
93
+ Look up the current service's containers
94
94
  ```
95
95
  api.get_service_containers.each do |name, container|
96
- puts("Container #{name} (ip: #{container['primary_ip']}, create index: #{container['create_index']}, service suffix: #{container['service_suffix']})")
96
+ puts("Container #{name} (ip: #{container['primary_ip']}, create index: #{container['create_index']}, service index: #{container['service_index']})")
97
97
  end
98
98
  ```
99
99
 
100
- look up a specific service's containers running in the current stack:
100
+ Look up a specific service's containers running in the current stack:
101
101
  ```
102
102
  api.get_service_containers({:service_name => 'my_service'}).each do |name, container|
103
- puts("Container #{name} (ip: #{container['primary_ip']}, create index: #{container['create_index']}, service suffix: #{container['service_suffix']})")
103
+ puts("Container #{name} (ip: #{container['primary_ip']}, create index: #{container['create_index']}, service index: #{container['service_index']})")
104
104
  end
105
105
  ```
106
106
 
107
107
  Look up a specific service's containers running in an another stack:
108
108
  ```
109
109
  api.get_service_containers({:service_name => 'my_service', :stack_name => 'my_stack'}).each do |name, container|
110
- puts("Container #{name} (ip: #{container['primary_ip']}, create index: #{container['create_index']}, service suffix: #{container['service_suffix']})")
110
+ puts("Container #{name} (ip: #{container['primary_ip']}, create index: #{container['create_index']}, service index: #{container['service_index']})")
111
111
  end
112
112
  ```
113
113
 
@@ -104,9 +104,6 @@ module RancherMetadata
104
104
 
105
105
  self.get_service_field("containers", service).each do |container|
106
106
  containers[container['name']] = container
107
-
108
- # FIXME: until https://github.com/rancher/cattle/pull/1197 gets merged
109
- containers[container['name']]['service_suffix'] = self.get_container_service_suffix(container['name']) unless container.has_key?('service_suffix')
110
107
  end
111
108
 
112
109
  containers
@@ -129,9 +126,6 @@ module RancherMetadata
129
126
  new = containers.keys()
130
127
 
131
128
  (new - old).each do |name|
132
- # FIXME: until https://github.com/rancher/cattle/pull/1197 gets merged
133
- containers[name]['service_suffix'] = self.get_container_service_suffix(name) unless containers[name].has_key?('service_suffix')
134
-
135
129
  yield(name, containers[name])
136
130
  end
137
131
 
@@ -168,11 +162,6 @@ module RancherMetadata
168
162
  container = self.api_get("/self/container")
169
163
  end
170
164
 
171
- # FIXME: until https://github.com/rancher/cattle/pull/1197 gets merged
172
- if container
173
- container['service_suffix'] = self.get_container_service_suffix(container_name) unless container.has_key?('service_suffix')
174
- end
175
-
176
165
  container
177
166
  end
178
167
 
@@ -180,10 +169,6 @@ module RancherMetadata
180
169
  container_name ? self.api_get("/containers/#{container_name}/#{field}") : self.api_get("/self/container/#{field}")
181
170
  end
182
171
 
183
- def get_container_id(container_name = nil)
184
- self.get_container_create_index(container_name)
185
- end
186
-
187
172
  def get_container_create_index(container_name = nil)
188
173
  i = self.get_container_field("create_index", container_name)
189
174
  i ? i.to_i : nil
@@ -219,24 +204,9 @@ module RancherMetadata
219
204
  self.get_container_field("hostname", container_name)
220
205
  end
221
206
 
222
- def get_container_service_id(container_name = nil)
223
- self.get_container_service_suffix(container_name)
224
- end
225
-
226
- def get_container_service_suffix(container_name = nil)
227
- index = nil
228
-
229
- service_suffix = self.get_container_field("service_suffix", container_name)
230
-
231
- if service_suffix.nil?
232
- if (i = self.get_container_name(container_name)[/(\d+)$/, 1])
233
- index = i.to_i
234
- end
235
- else
236
- index = service_suffix.to_i
237
- end
238
-
239
- index
207
+ def get_container_service_index(container_name = nil)
208
+ i = self.get_container_field("service_index", container_name)
209
+ i ? i.to_i : nil
240
210
  end
241
211
 
242
212
  def get_container_host_uuid(container_name = nil)
@@ -5,7 +5,7 @@
5
5
  #
6
6
 
7
7
  module RancherMetadata
8
- VERSION = "0.17.11"
8
+ VERSION = "0.17.12"
9
9
 
10
10
  def self.version
11
11
  VERSION
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rancher-metadata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.11
4
+ version: 0.17.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matteo Cerutti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-29 00:00:00.000000000 Z
11
+ date: 2016-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json