centurion 1.10.1 → 1.10.2

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: 51af32612106564d2523f46f98c8a862d855ec94
4
- data.tar.gz: b92dfa1483449ac9d90be790a11eb79ea50ebd4f
3
+ metadata.gz: fc7802eda143e2a4c3ea296957448e864b044dfd
4
+ data.tar.gz: 4aefded54c32d42cdb9d2e3a661e3aa087ee1bcc
5
5
  SHA512:
6
- metadata.gz: 264d38524264717e972df446a5dddd570ae7a913e05dee5be7306cfde7b03be221b48c8a6a3630d3b9e18f5b1345d34d66f09dc002185114a66f3f7a470f3b9d
7
- data.tar.gz: '0609e9e3ffbf3cafb689e2ba4f47bd49eaa6ab0af32423132eb53901c8979d87d2beb13b5ab3b84f9fbb8e51f4288950d2adeaf86435717cc365bbbe5686ed7d'
6
+ metadata.gz: e4dfe15cb4dda8e19c72a7870a4e6a987ca12ee4ac775b15443b97cc3ffbd3100bef6430b7a5be930e192dc4e818825e65fc22f76f1f2fb4df964e9c9b09ec10
7
+ data.tar.gz: 696f5cb9fb26a33a5bb4283ffd8c273c793bbb725bd1f2072ac3f662195af5401aaabe2e0a60eaf1f0c20942a4b90677b7b8b70f00fd865e6c2bc36ab76275f9
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
3
+ - 1.9.3-p551
4
4
  - 2.0.0
5
5
  - 2.1
6
6
  - 2.2
@@ -9,4 +9,7 @@ rvm:
9
9
  - 2.5
10
10
  before_install:
11
11
  - gem update
12
- - gem install bundler
12
+ # downgrade bundler to fix installation error with ruby <= 2.2
13
+ # https://docs.travis-ci.com/user/languages/ruby/#bundler-20
14
+ - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
15
+ - gem install bundler -v '< 2'
data/README.md CHANGED
@@ -401,9 +401,20 @@ You can configure it with a few options:
401
401
  set :ssh, true # enable ssh connections
402
402
  set :ssh_user, "myuser" # if you want to specify the user to connect as, otherwise your current user
403
403
  set :ssh_log_level, Logger::DEBUG # passed on to net/ssh, can be noisy; defaults to Logger::WARN
404
+ set :ssh_socket_heartbeat, 5 # passed on to net/ssh (Net::SSH::Connection::Session#loop); defaults to 30
404
405
  end
405
406
  ```
406
407
 
408
+ #### Troubleshooting SSH connections
409
+
410
+ In some cases you may notice your SSH commands are completing successfully,
411
+ but the connection isn't aware they are done. This will manifest as a tunneled
412
+ command taking much longer than anticipated - minutes depending on your
413
+ server's configuration. You may need to set `:ssh_socket_heartbeat` to a
414
+ smaller number. This will check more frequently if the command has completed
415
+ which can alleviate this issue, though it will consume more CPU as it wakes up
416
+ its threads more frequently.
417
+
407
418
  Deploying
408
419
  ---------
409
420
 
@@ -195,6 +195,7 @@ module Centurion::DeployDSL
195
195
  # nil is OK for both of these, defaults applied internally
196
196
  opts[:ssh_user] = fetch(:ssh_user)
197
197
  opts[:ssh_log_level] = fetch(:ssh_log_level)
198
+ opts[:ssh_socket_heartbeat] = fetch(:ssh_socket_heartbeat)
198
199
  end
199
200
 
200
201
  opts
@@ -12,8 +12,7 @@ class Centurion::DockerViaApi
12
12
  if connection_opts[:ssh]
13
13
  @base_uri = hostname
14
14
  @ssh = true
15
- @ssh_user = connection_opts[:ssh_user]
16
- @ssh_log_level = connection_opts[:ssh_log_level]
15
+ @connection_opts = connection_opts
17
16
  else
18
17
  @base_uri = "http#{'s' if tls_enable?}://#{hostname}:#{port}"
19
18
  end
@@ -194,7 +193,7 @@ class Centurion::DockerViaApi
194
193
  end
195
194
 
196
195
  def with_excon_via_ssh
197
- Centurion::SSH.with_docker_socket(@base_uri, @ssh_user, @ssh_log_level) do |socket|
196
+ Centurion::SSH.with_docker_socket(@base_uri, @connection_opts[:ssh_user], @connection_opts[:ssh_log_level], @connection_opts[:ssh_socket_heartbeat]) do |socket|
198
197
  conn = Excon.new('unix:///', socket: socket)
199
198
  yield conn
200
199
  end
@@ -97,7 +97,7 @@ class Centurion::DockerViaCli
97
97
 
98
98
  def connect
99
99
  if @connection_opts[:ssh]
100
- Centurion::SSH.with_docker_socket(@docker_host, @connection_opts[:ssh_user], @connection_opts[:ssh_log_level]) do |socket|
100
+ Centurion::SSH.with_docker_socket(@docker_host, @connection_opts[:ssh_user], @connection_opts[:ssh_log_level], @connection_opts[:ssh_socket_heartbeat]) do |socket|
101
101
  @socket = socket
102
102
  ret = yield
103
103
  @socket = nil
@@ -7,7 +7,7 @@ module Centurion; end
7
7
  module Centurion::SSH
8
8
  extend self
9
9
 
10
- def with_docker_socket(hostname, user, log_level = nil)
10
+ def with_docker_socket(hostname, user, log_level = nil, ssh_socket_heartbeat = 30)
11
11
  log_level ||= Logger::WARN
12
12
 
13
13
  with_sshkit(hostname, user) do
@@ -24,7 +24,7 @@ module Centurion::SSH
24
24
  yield local_socket_path
25
25
  end
26
26
 
27
- ssh.loop { t.alive? }
27
+ ssh.loop(ssh_socket_heartbeat) { t.alive? }
28
28
  ssh.forward.cancel_local_socket local_socket_path
29
29
  local_socket_path_file.delete
30
30
  t.value
@@ -1,3 +1,3 @@
1
1
  module Centurion
2
- VERSION = '1.10.1'
2
+ VERSION = '1.10.2'
3
3
  end
@@ -134,6 +134,7 @@ describe Centurion::DockerViaApi do
134
134
  let(:port) { nil }
135
135
  let(:ssh_user) { 'myuser' }
136
136
  let(:ssh_log_level) { nil }
137
+ let(:ssh_socket_heartbeat) { nil }
137
138
  let(:base_req) { {
138
139
  socket: '/tmp/socket/path'
139
140
  } }
@@ -142,12 +143,13 @@ describe Centurion::DockerViaApi do
142
143
  p = { ssh: true}
143
144
  p[:ssh_user] = ssh_user if ssh_user
144
145
  p[:ssh_log_level] = ssh_log_level if ssh_log_level
146
+ p[:ssh_socket_heartbeat] = ssh_socket_heartbeat if ssh_socket_heartbeat
145
147
  p
146
148
  end
147
149
 
148
150
  context 'with no log level' do
149
151
  before do
150
- expect(Centurion::SSH).to receive(:with_docker_socket).with(hostname, ssh_user, nil).and_yield('/tmp/socket/path')
152
+ expect(Centurion::SSH).to receive(:with_docker_socket).with(hostname, ssh_user, nil, nil).and_yield('/tmp/socket/path')
151
153
  end
152
154
 
153
155
  it_behaves_like 'docker API'
@@ -157,7 +159,7 @@ describe Centurion::DockerViaApi do
157
159
  let(:ssh_user) { nil }
158
160
 
159
161
  before do
160
- expect(Centurion::SSH).to receive(:with_docker_socket).with(hostname, nil, nil).and_yield('/tmp/socket/path')
162
+ expect(Centurion::SSH).to receive(:with_docker_socket).with(hostname, nil, nil, nil).and_yield('/tmp/socket/path')
161
163
  end
162
164
 
163
165
  it_behaves_like 'docker API'
@@ -167,7 +169,17 @@ describe Centurion::DockerViaApi do
167
169
  let(:ssh_log_level) { Logger::DEBUG }
168
170
 
169
171
  before do
170
- expect(Centurion::SSH).to receive(:with_docker_socket).with(hostname, ssh_user, Logger::DEBUG).and_yield('/tmp/socket/path')
172
+ expect(Centurion::SSH).to receive(:with_docker_socket).with(hostname, ssh_user, Logger::DEBUG, nil).and_yield('/tmp/socket/path')
173
+ end
174
+
175
+ it_behaves_like 'docker API'
176
+ end
177
+
178
+ context 'with a socket heartbeat set' do
179
+ let(:ssh_socket_heartbeat) { 5 }
180
+
181
+ before do
182
+ expect(Centurion::SSH).to receive(:with_docker_socket).with(hostname, ssh_user, nil, 5).and_yield('/tmp/socket/path')
171
183
  end
172
184
 
173
185
  it_behaves_like 'docker API'
@@ -69,18 +69,20 @@ describe Centurion::DockerViaCli do
69
69
  let(:hostname) { 'host1' }
70
70
  let(:ssh_user) { 'myuser' }
71
71
  let(:ssh_log_level) { nil }
72
+ let(:ssh_socket_heartbeat) { nil }
72
73
  let(:docker_via_cli) { Centurion::DockerViaCli.new(hostname, nil, docker_path, params) }
73
74
  let(:prefix) { "-H=unix:///tmp/socket/path" }
74
75
  let(:params) do
75
- p = { ssh: true}
76
+ p = { ssh: true }
76
77
  p[:ssh_user] = ssh_user if ssh_user
77
78
  p[:ssh_log_level] = ssh_log_level if ssh_log_level
79
+ p[:ssh_socket_heartbeat] = ssh_socket_heartbeat if ssh_socket_heartbeat
78
80
  p
79
81
  end
80
82
 
81
83
  context 'with no log level' do
82
84
  before do
83
- expect(Centurion::SSH).to receive(:with_docker_socket).with(hostname, ssh_user, nil).and_yield('/tmp/socket/path')
85
+ expect(Centurion::SSH).to receive(:with_docker_socket).with(hostname, ssh_user, nil, nil).and_yield('/tmp/socket/path')
84
86
  end
85
87
 
86
88
  it_behaves_like 'docker CLI'
@@ -90,7 +92,7 @@ describe Centurion::DockerViaCli do
90
92
  let(:ssh_user) { nil }
91
93
 
92
94
  before do
93
- expect(Centurion::SSH).to receive(:with_docker_socket).with(hostname, nil, nil).and_yield('/tmp/socket/path')
95
+ expect(Centurion::SSH).to receive(:with_docker_socket).with(hostname, nil, nil, nil).and_yield('/tmp/socket/path')
94
96
  end
95
97
 
96
98
  it_behaves_like 'docker CLI'
@@ -100,7 +102,17 @@ describe Centurion::DockerViaCli do
100
102
  let(:ssh_log_level) { Logger::DEBUG }
101
103
 
102
104
  before do
103
- expect(Centurion::SSH).to receive(:with_docker_socket).with(hostname, ssh_user, Logger::DEBUG).and_yield('/tmp/socket/path')
105
+ expect(Centurion::SSH).to receive(:with_docker_socket).with(hostname, ssh_user, Logger::DEBUG, nil).and_yield('/tmp/socket/path')
106
+ end
107
+
108
+ it_behaves_like 'docker CLI'
109
+ end
110
+
111
+ context 'with an ssh loop wait set' do
112
+ let(:ssh_socket_heartbeat) { 5 }
113
+
114
+ before do
115
+ expect(Centurion::SSH).to receive(:with_docker_socket).with(hostname, ssh_user, nil, 5).and_yield('/tmp/socket/path')
104
116
  end
105
117
 
106
118
  it_behaves_like 'docker CLI'
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.10.1
4
+ version: 1.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nic Benders
@@ -21,7 +21,7 @@ authors:
21
21
  autorequire:
22
22
  bindir: bin
23
23
  cert_chain: []
24
- date: 2018-12-06 00:00:00.000000000 Z
24
+ date: 2019-07-20 00:00:00.000000000 Z
25
25
  dependencies:
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: trollop