train 0.24.0 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -2
- data/lib/train.rb +2 -1
- data/lib/train/extras.rb +8 -8
- data/lib/train/extras/os_detect_linux.rb +2 -3
- data/lib/train/plugins.rb +1 -1
- data/lib/train/plugins/transport.rb +1 -1
- data/lib/train/transports/local.rb +3 -3
- data/lib/train/transports/local_file.rb +1 -1
- data/lib/train/transports/ssh.rb +1 -1
- data/lib/train/transports/winrm.rb +1 -1
- data/lib/train/version.rb +1 -1
- data/test/unit/extras/os_detect_linux_test.rb +12 -0
- data/test/unit/train_test.rb +24 -0
- 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: 3d5ba0a8f8379e5671fbe8175b6a30f738b37325
|
4
|
+
data.tar.gz: 7de578f40b6116ce01c5d0a2bcf163d627f05d98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d0dc0adf8e12a97c53852ac99ca904ca188e5457ba51bc82cc7e8c14506c8905a706bf2a66a509fe227835d8be053bcd8af9272a8b8f7d1ee4e31bddbe1faca
|
7
|
+
data.tar.gz: 744b6133eba631cc0e89926b46484865fe21868064d9ded6b4f7176748525c02464b3c228f95e59c6940794835d4fc2200b7b5523877f4af41868b9c046b1cd5
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,16 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [0.
|
4
|
-
[Full Changelog](https://github.com/chef/train/compare/v0.
|
3
|
+
## [0.25.0](https://github.com/chef/train/tree/0.25.0) (2017-06-15)
|
4
|
+
[Full Changelog](https://github.com/chef/train/compare/v0.24.0...0.25.0)
|
5
|
+
|
6
|
+
**Merged pull requests:**
|
7
|
+
|
8
|
+
- Fix CoreOS platform detection [\#180](https://github.com/chef/train/pull/180) ([rarenerd](https://github.com/rarenerd))
|
9
|
+
- Remove autoloads in favor of eager loading [\#178](https://github.com/chef/train/pull/178) ([Sharpie](https://github.com/Sharpie))
|
10
|
+
- Fixed IPv6 URI parsing [\#176](https://github.com/chef/train/pull/176) ([zfjagann](https://github.com/zfjagann))
|
11
|
+
|
12
|
+
## [v0.24.0](https://github.com/chef/train/tree/v0.24.0) (2017-05-30)
|
13
|
+
[Full Changelog](https://github.com/chef/train/compare/v0.23.0...v0.24.0)
|
5
14
|
|
6
15
|
**Merged pull requests:**
|
7
16
|
|
data/lib/train.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
# Author:: Dominik Richter (<dominik.richter@gmail.com>)
|
4
4
|
|
5
5
|
require 'train/version'
|
6
|
+
require 'train/options'
|
6
7
|
require 'train/plugins'
|
7
8
|
require 'train/errors'
|
8
9
|
require 'uri'
|
@@ -61,7 +62,7 @@ module Train
|
|
61
62
|
uri = parse_uri(conf[:target].to_s)
|
62
63
|
unless uri.host.nil? and uri.scheme.nil?
|
63
64
|
conf[:backend] ||= uri.scheme
|
64
|
-
conf[:host] ||= uri.
|
65
|
+
conf[:host] ||= uri.hostname
|
65
66
|
conf[:port] ||= uri.port
|
66
67
|
conf[:user] ||= uri.user
|
67
68
|
conf[:password] ||= uri.password
|
data/lib/train/extras.rb
CHANGED
@@ -3,14 +3,14 @@
|
|
3
3
|
# Author:: Dominik Richter (<dominik.richter@gmail.com>)
|
4
4
|
|
5
5
|
module Train::Extras
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
require 'train/extras/command_wrapper'
|
7
|
+
require 'train/extras/file_common'
|
8
|
+
require 'train/extras/file_unix'
|
9
|
+
require 'train/extras/file_aix'
|
10
|
+
require 'train/extras/file_linux'
|
11
|
+
require 'train/extras/file_windows'
|
12
|
+
require 'train/extras/os_common'
|
13
|
+
require 'train/extras/stat'
|
14
14
|
|
15
15
|
CommandResult = Struct.new(:stdout, :stderr, :exit_status)
|
16
16
|
LoginCommand = Struct.new(:command, :arguments)
|
@@ -85,10 +85,9 @@ module Train::Extras
|
|
85
85
|
elsif !(raw = get_config('/etc/alpine-release')).nil?
|
86
86
|
@platform[:name] = 'alpine'
|
87
87
|
@platform[:release] = raw.strip
|
88
|
-
elsif !
|
88
|
+
elsif !get_config('/etc/coreos/update.conf').nil?
|
89
89
|
@platform[:name] = 'coreos'
|
90
|
-
|
91
|
-
@platform[:release] = meta[:release]
|
90
|
+
@platform[:release] = lsb[:release]
|
92
91
|
elsif !(os_info = fetch_os_release).nil?
|
93
92
|
if os_info['ID_LIKE'] =~ /wrlinux/
|
94
93
|
@platform[:name] = 'wrlinux'
|
data/lib/train/plugins.rb
CHANGED
@@ -12,14 +12,14 @@ module Train::Transports
|
|
12
12
|
|
13
13
|
include_options Train::Extras::CommandWrapper
|
14
14
|
|
15
|
-
autoload :File, 'train/transports/local_file'
|
16
|
-
autoload :OS, 'train/transports/local_os'
|
17
|
-
|
18
15
|
def connection(_ = nil)
|
19
16
|
@connection ||= Connection.new(@options)
|
20
17
|
end
|
21
18
|
|
22
19
|
class Connection < BaseConnection
|
20
|
+
require 'train/transports/local_file'
|
21
|
+
require 'train/transports/local_os'
|
22
|
+
|
23
23
|
def initialize(options)
|
24
24
|
super(options)
|
25
25
|
@cmd_wrapper = nil
|
data/lib/train/transports/ssh.rb
CHANGED
@@ -36,7 +36,7 @@ module Train::Transports
|
|
36
36
|
class SSH < Train.plugin(1)
|
37
37
|
name 'ssh'
|
38
38
|
|
39
|
-
|
39
|
+
require 'train/transports/ssh_connection'
|
40
40
|
|
41
41
|
# add options for submodules
|
42
42
|
include_options Train::Extras::CommandWrapper
|
data/lib/train/version.rb
CHANGED
@@ -107,6 +107,18 @@ describe 'os_detect_linux' do
|
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
|
+
describe '/etc/coreos/update.conf' do
|
111
|
+
it 'sets the correct family/release for coreos' do
|
112
|
+
detector.stubs(:get_config).with('/etc/coreos/update.conf').returns('data')
|
113
|
+
detector.stubs(:lsb).returns({ id: 'Container Linux by CoreOS', release: 'coreos-version' })
|
114
|
+
|
115
|
+
detector.detect_linux_via_config.must_equal(true)
|
116
|
+
detector.platform[:name].must_equal('coreos')
|
117
|
+
detector.platform[:family].must_equal('coreos')
|
118
|
+
detector.platform[:release].must_equal('coreos-version')
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
110
122
|
describe '/etc/os-release' do
|
111
123
|
describe 'when not on a wrlinux build' do
|
112
124
|
it 'does not set a platform family/release' do
|
data/test/unit/train_test.rb
CHANGED
@@ -129,6 +129,30 @@ describe Train do
|
|
129
129
|
res.must_equal nu
|
130
130
|
end
|
131
131
|
|
132
|
+
it 'supports IPv4 URIs' do
|
133
|
+
org = { target: 'mock://1.2.3.4:123' }
|
134
|
+
res = Train.target_config(org)
|
135
|
+
res[:backend].must_equal 'mock'
|
136
|
+
res[:host].must_equal '1.2.3.4'
|
137
|
+
res[:user].must_be_nil
|
138
|
+
res[:password].must_be_nil
|
139
|
+
res[:port].must_equal 123
|
140
|
+
res[:path].must_be_nil
|
141
|
+
res[:target].must_equal org[:target]
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'supports IPv6 URIs' do
|
145
|
+
org = { target: 'mock://[abc::def]:123' }
|
146
|
+
res = Train.target_config(org)
|
147
|
+
res[:backend].must_equal 'mock'
|
148
|
+
res[:host].must_equal 'abc::def'
|
149
|
+
res[:user].must_be_nil
|
150
|
+
res[:password].must_be_nil
|
151
|
+
res[:port].must_equal 123
|
152
|
+
res[:path].must_be_nil
|
153
|
+
res[:target].must_equal org[:target]
|
154
|
+
end
|
155
|
+
|
132
156
|
it 'supports empty URIs with schema://' do
|
133
157
|
org = { target: 'mock://' }
|
134
158
|
res = Train.target_config(org)
|
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.25.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: 2017-
|
11
|
+
date: 2017-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|