vx-container_connector 0.2.6 → 0.2.7

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: ac0678ace6c0b5769744cdb0e655d4e63b4900d3
4
- data.tar.gz: b06128dbfb44098fe8ef0a2e1cb7202eaac7ca46
3
+ metadata.gz: dd2b8b0551d449bcdc5e71117af7df9850aef1c3
4
+ data.tar.gz: fac8df9b3c35e10aee7ac712781bfcc0117c2f73
5
5
  SHA512:
6
- metadata.gz: d62f37c16b0329d679a5e9df1d4a2fae4522a46d1026d375ae1455e6cf81619952a1f86ad52467e055fc5b19f714fb4ac92ce9160f35fc868d678d7ba05753df
7
- data.tar.gz: 25b05b23497cb46beded12e974df85b58827118781a47a7dc2dbb5f1b4d5ab717d617419fa4db4f68f90c9b864cd3fc6bca20eda3f1bbc69e6a3ece78350433d
6
+ metadata.gz: 4e66db65e5463f92d8c9ae708706a9d0a12848876db907cb806cb294ed6d0e35fbbbd1b5e227010c1fc782a2afd742f5889524f624197cc92ae6512dde6be379
7
+ data.tar.gz: ad366eb332fe6946d1afe98a92823a09ebbaddfe8472b9f55ee15ec83bd8d9e8c84eb6c187babe10521ec5738782db3853577ec2fb4aa6b98ca4d0cc98827afa
@@ -67,27 +67,20 @@ module Vx
67
67
  forward_agent: false
68
68
  }
69
69
  logger.info "open ssh session to #{user}@#{host}"
70
- attempts = 0
71
- begin
70
+ with_retries ::Net::SSH::AuthenticationFailed, limit: 3, sleep: 3 do
72
71
  open_ssh(host, user, ssh_options) do |ssh|
73
72
  logger.info "ssh session opened"
74
73
  yield Spawner.new(container, ssh, remote_dir)
75
74
  end
76
- rescue ::Net::SSH::AuthenticationFailed => e
77
- logger.error "got #{e.inspect}, retry #{attempts}"
78
- sleep 0.5
79
- attempts += 1
80
- if attempts > 5
81
- raise e
82
- else
83
- retry
84
- end
85
75
  end
86
76
  end
87
77
 
88
78
  def start_container(&block)
89
79
  container = ::Docker::Container.create container_options
90
- container.start
80
+
81
+ with_retries ::Docker::Error::NotFoundError, limit: 3, sleep: 3 do
82
+ container.start
83
+ end
91
84
 
92
85
  begin
93
86
  logger.info "start container #{container.id}"
@@ -26,6 +26,7 @@ module Vx
26
26
  begin
27
27
  yield
28
28
  rescue *exceptions => e
29
+ $stderr.puts "got: #{inspect}, attempt #{retried}"
29
30
  if retried + 1 < options[:limit]
30
31
  retried += 1
31
32
  sleep options[:sleep]
@@ -1,5 +1,5 @@
1
1
  module Vx
2
2
  module ContainerConnector
3
- VERSION = "0.2.6"
3
+ VERSION = "0.2.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vx-container_connector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Galinsky