train 0.14.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -3
- data/lib/train/transports/ssh.rb +6 -0
- data/lib/train/transports/ssh_connection.rb +6 -0
- data/lib/train/version.rb +1 -1
- data/test/unit/transports/ssh_test.rb +8 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f020e9a89665da74d365404f73545dc4013e7b5d
|
4
|
+
data.tar.gz: 7f2bb4294fa689083feafe2c3f15292526a16b9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83841c985b413817cab9d1a32dd8994da7a28c15b4970f913ecc1efe7fa73cf7e67307c8d3072c679148ee211457a81b48d908111b6ed2e31162d67e55ae4e16
|
7
|
+
data.tar.gz: c4e458d0b9bfeec58c308c9620bd492063f614abd30b48e0aadef3d2fb74e5f0c3174cc1783a07e6f45a1a49c61451b667bf57ee575ed40df90ab78130398b20
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,18 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [0.
|
4
|
-
[Full Changelog](https://github.com/chef/train/compare/v0.14.
|
3
|
+
## [0.15.0](https://github.com/chef/train/tree/0.15.0) (2016-07-01)
|
4
|
+
[Full Changelog](https://github.com/chef/train/compare/v0.14.2...0.15.0)
|
5
|
+
|
6
|
+
**Implemented enhancements:**
|
7
|
+
|
8
|
+
- have net-ssh request a pty [\#60](https://github.com/chef/train/issues/60)
|
9
|
+
|
10
|
+
**Merged pull requests:**
|
11
|
+
|
12
|
+
- Allow requesting a PTY [\#121](https://github.com/chef/train/pull/121) ([srenatus](https://github.com/srenatus))
|
13
|
+
|
14
|
+
## [v0.14.2](https://github.com/chef/train/tree/v0.14.2) (2016-06-28)
|
15
|
+
[Full Changelog](https://github.com/chef/train/compare/v0.14.1...v0.14.2)
|
5
16
|
|
6
17
|
**Merged pull requests:**
|
7
18
|
|
@@ -32,7 +43,6 @@
|
|
32
43
|
|
33
44
|
**Implemented enhancements:**
|
34
45
|
|
35
|
-
- have net-ssh request a pty [\#60](https://github.com/chef/train/issues/60)
|
36
46
|
- use train as gem name. Thanks @halo [\#115](https://github.com/chef/train/pull/115) ([chris-rock](https://github.com/chris-rock))
|
37
47
|
|
38
48
|
## [v0.13.0](https://github.com/chef/train/tree/v0.13.0) (2016-06-16)
|
data/lib/train/transports/ssh.rb
CHANGED
@@ -27,6 +27,7 @@ module Train::Transports
|
|
27
27
|
#
|
28
28
|
# @author Fletcher Nichol <fnichol@nichol.ca>
|
29
29
|
class SSHFailed < Train::TransportError; end
|
30
|
+
class SSHPTYFailed < Train::TransportError; end
|
30
31
|
|
31
32
|
# A Transport which uses the SSH protocol to execute commands and transfer
|
32
33
|
# files.
|
@@ -55,6 +56,7 @@ module Train::Transports
|
|
55
56
|
option :connection_retry_sleep, default: 1
|
56
57
|
option :max_wait_until_ready, default: 600
|
57
58
|
option :compression, default: false
|
59
|
+
option :pty, default: false
|
58
60
|
|
59
61
|
option :compression_level do |opts|
|
60
62
|
# on nil or false: set compression level to 0
|
@@ -98,6 +100,10 @@ module Train::Transports
|
|
98
100
|
options[:auth_methods].push('password', 'keyboard-interactive')
|
99
101
|
end
|
100
102
|
|
103
|
+
if options[:pty]
|
104
|
+
logger.warn('[SSH] PTY requested: stderr will be merged into stdout')
|
105
|
+
end
|
106
|
+
|
101
107
|
super
|
102
108
|
self
|
103
109
|
end
|
@@ -79,6 +79,12 @@ class Train::Transports::SSH
|
|
79
79
|
# wrap commands if that is configured
|
80
80
|
cmd = @cmd_wrapper.run(cmd) unless @cmd_wrapper.nil?
|
81
81
|
|
82
|
+
if @transport_options[:pty]
|
83
|
+
channel.request_pty do |_ch, success|
|
84
|
+
fail Train::Transports::SSHPTYFailed, 'Requesting PTY failed' unless success
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
82
88
|
channel.exec(cmd) do |_, success|
|
83
89
|
abort 'Couldn\'t execute command on SSH.' unless success
|
84
90
|
|
data/lib/train/version.rb
CHANGED
@@ -42,6 +42,10 @@ describe 'ssh transport' do
|
|
42
42
|
it 'has default user' do
|
43
43
|
ssh.options[:user].must_equal 'root'
|
44
44
|
end
|
45
|
+
|
46
|
+
it 'by default does not request a pty' do
|
47
|
+
ssh.options[:pty].must_equal false
|
48
|
+
end
|
45
49
|
end
|
46
50
|
|
47
51
|
describe 'opening a connection' do
|
@@ -83,7 +87,7 @@ describe 'ssh transport' do
|
|
83
87
|
end
|
84
88
|
|
85
89
|
describe 'converting connection to string for logging' do
|
86
|
-
it
|
90
|
+
it 'masks passwords' do
|
87
91
|
assert_output(/.*:password=>"<hidden>".*/) do
|
88
92
|
connection = cls.new(conf).connection
|
89
93
|
puts "#{connection}"
|
@@ -96,7 +100,7 @@ describe 'ssh transport' do
|
|
96
100
|
cls.new(conf).connection
|
97
101
|
end
|
98
102
|
|
99
|
-
it '
|
103
|
+
it 'does not like host == nil' do
|
100
104
|
conf.delete(:host)
|
101
105
|
proc { cls.new(conf).connection }.must_raise Train::ClientError
|
102
106
|
end
|
@@ -106,13 +110,13 @@ describe 'ssh transport' do
|
|
106
110
|
cls.new(conf).connection.method(:options).call[:user] == 'root'
|
107
111
|
end
|
108
112
|
|
109
|
-
it '
|
113
|
+
it 'does not like key and password == nil' do
|
110
114
|
conf.delete(:password)
|
111
115
|
conf.delete(:key_files)
|
112
116
|
proc { cls.new(conf).connection }.must_raise Train::ClientError
|
113
117
|
end
|
114
118
|
|
115
|
-
it 'wont connect if
|
119
|
+
it 'wont connect if it is not possible' do
|
116
120
|
conf[:host] = 'localhost'
|
117
121
|
conf[:port] = 1
|
118
122
|
conn = cls.new(conf).connection
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: train
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominik Richter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|