vx-lib-container 0.5.11 → 0.6.0

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: 594a66b891b11810ba46b7855a8819beec140105
4
- data.tar.gz: c1841c4ed5ba9b62cf4b4a4253b971572061e190
3
+ metadata.gz: 2aa9c3e92022ed99759a8493f55ca3bda44459a6
4
+ data.tar.gz: 711b942d04d5e771cebc2883be205ef9f499be15
5
5
  SHA512:
6
- metadata.gz: 86acd9f9bd64dbf9d982534b21e0c25dd726e50cc8509bde650e83286a2b36fb20bf29d26106957d48364feeec58010a4d4902db45ba4c13f1db3d26b778a125
7
- data.tar.gz: 53ee3f5467ba0cc3ac8bfd6d22585df3117ca6e03801fc072a36f9f28eb3f1d4bdb09df9924dda8097e9956043abf3144215c8a21fb5f8f03575187cdaeca38a
6
+ metadata.gz: da843df18fa69d2e606f2b8f604ede2f276656e37675799a248221bd67617d2e488f9dd5a7c1ee53cd40e3efd4f497e9635694caac5c47b43c413eb1598a3aab
7
+ data.tar.gz: b2664f01f405660715fd9c8dd93f7bfb9d936146fbc62fd4fef8d464bee8285b9ebef7d3ec9c061ea0bc71413b55b9c09c832b92b872ab8e662bc62a16d5f503
@@ -8,13 +8,10 @@ module Vx
8
8
  autoload :Local, File.expand_path("../container/local", __FILE__)
9
9
  autoload :Docker, File.expand_path("../container/docker", __FILE__)
10
10
  autoload :Retriable, File.expand_path("../container/mixin/retriable", __FILE__)
11
- autoload :Instrument, File.expand_path("../container/mixin/instrument", __FILE__)
12
11
  autoload :Upload, File.expand_path("../container/mixin/upload", __FILE__)
13
12
 
14
13
  extend self
15
14
 
16
- attr_accessor :instrumenter
17
-
18
15
  def lookup(name, options = {})
19
16
  case name.to_sym
20
17
  when :docker
@@ -14,7 +14,6 @@ module Vx
14
14
 
15
15
  include Lib::Shell
16
16
  include Lib::Container::Retriable
17
- include Lib::Container::Instrument
18
17
 
19
18
  attr_reader :user, :password, :init, :image, :remote_dir, :memory, :memory_swap
20
19
 
@@ -55,16 +54,8 @@ module Vx
55
54
  timeout: 3,
56
55
  }
57
56
 
58
- instrumentation = {
59
- container_type: "docker",
60
- container: container.json,
61
- ssh_options: ssh_options.merge(host: host, user: user)
62
- }
63
-
64
57
  ssh = with_retries ::Net::SSH::AuthenticationFailed, ::Errno::ECONNREFUSED, ::Errno::ETIMEDOUT, ::Timeout::Error, limit: 5, sleep: 3 do
65
- instrument("start_ssh_session", instrumentation) do
66
- ::Net::SSH.start host, user, ssh_options
67
- end
58
+ ::Net::SSH.start host, user, ssh_options
68
59
  end
69
60
 
70
61
  re = yield Spawner.new(container, ssh)
@@ -75,27 +66,16 @@ module Vx
75
66
  def start_container(&block)
76
67
  container =
77
68
  with_retries ::Docker::Error::TimeoutError, limit: 5, sleep: 3 do
78
- instrument("create", container_type: "docker", container_options: create_container_options) do
79
- ::Docker::Container.create create_container_options
80
- end
69
+ ::Docker::Container.create create_container_options
81
70
  end
82
71
 
83
- instrumentation = {
84
- container_type: "docker",
85
- container: container.json
86
- }
87
-
88
- instrument("start", instrumentation) do
89
- container.start
90
- end
72
+ container.start
91
73
 
92
74
  begin
93
75
  yield container
94
76
  ensure
95
- instrument("kill", instrumentation) do
96
- container.kill
97
- container.remove
98
- end
77
+ container.kill
78
+ container.remove
99
79
  end
100
80
  end
101
81
 
@@ -22,6 +22,10 @@ module Vx ; module Lib ; module Container ;
22
22
  container.id
23
23
  end
24
24
 
25
+ def properties
26
+ container.json
27
+ end
28
+
25
29
  end
26
30
  end
27
31
 
@@ -17,18 +17,14 @@ module Vx ; module Lib ; module Container ;
17
17
  end
18
18
 
19
19
  def start(&block)
20
- instrument( "create", container_type: 'local', container: { work_dir: work_dir }) do
21
- FileUtils.rm_rf(work_dir)
22
- FileUtils.mkdir_p(work_dir)
23
- end
20
+ FileUtils.rm_rf(work_dir)
21
+ FileUtils.mkdir_p(work_dir)
24
22
 
25
23
  begin
26
24
  spawner = Spawner.new(work_dir)
27
25
  yield spawner
28
26
  ensure
29
- instrument( "kill", container_type: 'local', container: { work_dir: work_dir }) do
30
- FileUtils.mkdir_p(work_dir)
31
- end
27
+ FileUtils.mkdir_p(work_dir)
32
28
  end
33
29
  end
34
30
 
@@ -21,6 +21,10 @@ module Vx
21
21
  work_dir
22
22
  end
23
23
 
24
+ def properties
25
+ {}
26
+ end
27
+
24
28
  end
25
29
  end
26
30
  end
@@ -1,7 +1,7 @@
1
1
  module Vx
2
2
  module Lib
3
3
  module Container
4
- VERSION = "0.5.11"
4
+ VERSION = "0.6.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vx-lib-container
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.11
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Galinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-08 00:00:00.000000000 Z
11
+ date: 2014-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docker-api
@@ -100,7 +100,6 @@ files:
100
100
  - lib/vx/lib/container/errors.rb
101
101
  - lib/vx/lib/container/local.rb
102
102
  - lib/vx/lib/container/local/spawner.rb
103
- - lib/vx/lib/container/mixin/instrument.rb
104
103
  - lib/vx/lib/container/mixin/retriable.rb
105
104
  - lib/vx/lib/container/mixin/upload.rb
106
105
  - lib/vx/lib/container/version.rb
@@ -1,23 +0,0 @@
1
- module Vx
2
- module Lib
3
- module Container
4
- module Instrument
5
-
6
- def instrument(name, payload, &block)
7
- name = "#{name}.container.lib.vx"
8
-
9
- if ENV['DEBUG']
10
- $stdout.puts " --> #{name}: #{payload}"
11
- end
12
-
13
- if inst = Container.instrumenter
14
- inst.instrument(name, payload, &block)
15
- else
16
- yield if block_given?
17
- end
18
- end
19
- end
20
-
21
- end
22
- end
23
- end