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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 380cb81ba3b1d72ce15736240e1f24ee21b2c44f
4
- data.tar.gz: 1905fe211a29868e810a9bd07c736817b262cee7
3
+ metadata.gz: 3d5ba0a8f8379e5671fbe8175b6a30f738b37325
4
+ data.tar.gz: 7de578f40b6116ce01c5d0a2bcf163d627f05d98
5
5
  SHA512:
6
- metadata.gz: d2b4b3d6d9373376766c691629201f922e39699dc1e3c2fa5962235b851110c55901040b491c18fbf472d3acf6616159be2aa2c8f310ca3935f7f92f916b7109
7
- data.tar.gz: aece6b8119d0d5aa9a4c8a8ae6846009b0105a5724b03f70b3e6fc6ba09d9a21461826405bc54e6e72d8f2a02db9d449e72056e59ea319df32279ca01a689a89
6
+ metadata.gz: 9d0dc0adf8e12a97c53852ac99ca904ca188e5457ba51bc82cc7e8c14506c8905a706bf2a66a509fe227835d8be053bcd8af9272a8b8f7d1ee4e31bddbe1faca
7
+ data.tar.gz: 744b6133eba631cc0e89926b46484865fe21868064d9ded6b4f7176748525c02464b3c228f95e59c6940794835d4fc2200b7b5523877f4af41868b9c046b1cd5
@@ -1,7 +1,16 @@
1
1
  # Change Log
2
2
 
3
- ## [0.24.0](https://github.com/chef/train/tree/0.24.0) (2017-05-30)
4
- [Full Changelog](https://github.com/chef/train/compare/v0.23.0...0.24.0)
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
 
@@ -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.host
65
+ conf[:host] ||= uri.hostname
65
66
  conf[:port] ||= uri.port
66
67
  conf[:user] ||= uri.user
67
68
  conf[:password] ||= uri.password
@@ -3,14 +3,14 @@
3
3
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
4
4
 
5
5
  module Train::Extras
6
- autoload :CommandWrapper, 'train/extras/command_wrapper'
7
- autoload :FileCommon, 'train/extras/file_common'
8
- autoload :AixFile, 'train/extras/file_aix'
9
- autoload :UnixFile, 'train/extras/file_unix'
10
- autoload :LinuxFile, 'train/extras/file_linux'
11
- autoload :WindowsFile, 'train/extras/file_windows'
12
- autoload :OSCommon, 'train/extras/os_common'
13
- autoload :Stat, 'train/extras/stat'
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 !(raw = get_config('/etc/coreos/update.conf')).nil?
88
+ elsif !get_config('/etc/coreos/update.conf').nil?
89
89
  @platform[:name] = 'coreos'
90
- meta = lsb_config(raw)
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'
@@ -7,7 +7,7 @@ require 'train/errors'
7
7
 
8
8
  module Train
9
9
  class Plugins
10
- autoload :Transport, 'train/plugins/transport'
10
+ require 'train/plugins/transport'
11
11
 
12
12
  class << self
13
13
  # Retrieve the current plugin registry, containing all plugin names
@@ -13,7 +13,7 @@ class Train::Plugins
13
13
  include Train::Extras
14
14
  Train::Options.attach(self)
15
15
 
16
- autoload :BaseConnection, 'train/plugins/base_connection'
16
+ require 'train/plugins/base_connection'
17
17
 
18
18
  # Initialize a new Transport object
19
19
  #
@@ -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
@@ -6,7 +6,7 @@
6
6
  require 'train/extras'
7
7
 
8
8
  class Train::Transports::Local::Connection
9
- class File < LinuxFile
9
+ class File < Train::Extras::LinuxFile
10
10
  def content
11
11
  @content ||= ::File.read(@path, encoding: 'UTF-8')
12
12
  rescue StandardError => _
@@ -36,7 +36,7 @@ module Train::Transports
36
36
  class SSH < Train.plugin(1)
37
37
  name 'ssh'
38
38
 
39
- autoload :Connection, 'train/transports/ssh_connection'
39
+ require 'train/transports/ssh_connection'
40
40
 
41
41
  # add options for submodules
42
42
  include_options Train::Extras::CommandWrapper
@@ -38,7 +38,7 @@ module Train::Transports
38
38
  class WinRM < Train.plugin(1)
39
39
  name 'winrm'
40
40
 
41
- autoload :Connection, 'train/transports/winrm_connection'
41
+ require 'train/transports/winrm_connection'
42
42
 
43
43
  # common target configuration
44
44
  option :host, required: true
@@ -3,5 +3,5 @@
3
3
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
4
4
 
5
5
  module Train
6
- VERSION = '0.24.0'.freeze
6
+ VERSION = '0.25.0'.freeze
7
7
  end
@@ -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
@@ -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.24.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-05-30 00:00:00.000000000 Z
11
+ date: 2017-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json