centurion 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Centurion
2
- VERSION = '1.4.1'
2
+ VERSION = '1.4.2'
3
3
  end
@@ -162,7 +162,11 @@ namespace :deploy do
162
162
  task :determine_image_id_from_first_server do
163
163
  on_each_docker_host do |target_server|
164
164
  image_detail = target_server.inspect_image(fetch(:image), fetch(:tag))
165
- exact_image = image_detail["id"]
165
+
166
+ # Handle CamelCase in response from Docker API
167
+ # See https://github.com/newrelic/centurion/issues/85
168
+ exact_image = image_detail["id"] || image_detail["Id"]
169
+
166
170
  set :image_id, exact_image
167
171
  info "RESOLVED #{fetch(:image)}:#{fetch(:tag)} => #{exact_image[0..11]}"
168
172
  break
@@ -192,7 +196,10 @@ namespace :deploy do
192
196
  task :verify_image do
193
197
  on_each_docker_host do |target_server|
194
198
  image_detail = target_server.inspect_image(fetch(:image), fetch(:tag))
195
- found_image_id = image_detail["id"]
199
+
200
+ # Handle CamelCase in response from Docker API
201
+ # See https://github.com/newrelic/centurion/issues/85
202
+ found_image_id = image_detail["id"] || image_detail["Id"]
196
203
 
197
204
  if found_image_id == fetch(:image_id)
198
205
  info "Image #{found_image_id[0..7]} found on #{target_server.hostname}"
@@ -200,8 +207,11 @@ namespace :deploy do
200
207
  raise "Did not find image #{fetch(:image_id)} on host #{target_server.hostname}!"
201
208
  end
202
209
 
210
+ # Again, handle CamelCase in response from Docker API
211
+ container_config = image_detail["container_config"] || image_detail["ContainerConfig"]
212
+
203
213
  # Print the container config
204
- image_detail["container_config"].each_pair do |key,value|
214
+ container_config.each_pair do |key,value|
205
215
  info "\t#{key} => #{value.inspect}"
206
216
  end
207
217
  end
@@ -11,6 +11,13 @@ describe Centurion::Dogestry do
11
11
  }
12
12
  let(:registry) { Centurion::Dogestry.new(dogestry_options) }
13
13
  let(:repo) { 'google/golang' }
14
+ let(:pull_hosts) {
15
+ [
16
+ 'tcp://host-1:2375',
17
+ 'tcp://host-2:2375'
18
+ ]
19
+ }
20
+ let(:flags) { "-pullhosts #{pull_hosts.join(',')}"}
14
21
 
15
22
  describe '#aws_access_key_id' do
16
23
  it 'returns correct value' do
@@ -51,8 +58,8 @@ describe Centurion::Dogestry do
51
58
  describe '#pull' do
52
59
  it 'returns correct value' do
53
60
  if registry.which('dogestry')
54
- expect(registry).to receive(:echo).with("dogestry pull #{registry.s3_url} #{repo}")
55
- registry.pull(repo, {})
61
+ expect(registry).to receive(:echo).with("dogestry #{flags} pull #{registry.s3_url} #{repo}")
62
+ registry.pull(repo, pull_hosts)
56
63
  end
57
64
  end
58
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: centurion
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -21,7 +21,7 @@ authors:
21
21
  autorequire:
22
22
  bindir: bin
23
23
  cert_chain: []
24
- date: 2015-01-09 00:00:00.000000000 Z
24
+ date: 2015-01-26 00:00:00.000000000 Z
25
25
  dependencies:
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: trollop