train 1.5.6 → 1.5.11

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
  SHA256:
3
- metadata.gz: ce0372a342eb1702aac1255a5cfaadfdd5af73bd46a87e8a5b34f8723a4bfc5e
4
- data.tar.gz: 56157c304c959c95cb162fb71c6d2f9f431bf08bea2e6d893c56076d856380f0
3
+ metadata.gz: 4053a5448990953c02982f884a3af8d00166920843713ffea3e126848db9f04e
4
+ data.tar.gz: 468e054659adf76575bc32bb56b3b31e615ba3eae84601573689bcfd1881abd6
5
5
  SHA512:
6
- metadata.gz: d9f4a5d1598844f73eff994fee266ab5757e62cd1c2c9e3b69245d7f9db5fa3db6361151df7d1720762919644cf24c15248c18b85701c25153ee4e6d2cfd2da7
7
- data.tar.gz: e2605fe51549fe888f22e6a16c186b1945a9630a399642eee951dc34446ae1cc461ae264db0979737fb0cd5f060b2cb03e845d7108d2c7a5cf57bcc5a3161565
6
+ metadata.gz: 0c6921286cd8ae8779452e28cc9f0d0ad2e97223e2b39cad4593a2774e92c2580eae78f24f664136948c9746e76076a72f51ed55e11fdeacbc569f8c49335ca2
7
+ data.tar.gz: '06485051796b00ec02e7325f211f61de842008e386a8b855eef52166fe7160975a9745a68305dd669aa8341bcfdafafbae2e3cb6a47ca6803371621cfc5554d5'
@@ -1,19 +1,29 @@
1
- <!-- latest_release 1.5.6 -->
2
- ## [v1.5.6](https://github.com/inspec/train/tree/v1.5.6) (2018-11-01)
1
+ <!-- latest_release 1.5.11 -->
2
+ ## [v1.5.11](https://github.com/inspec/train/tree/v1.5.11) (2018-12-10)
3
3
 
4
4
  #### Merged Pull Requests
5
- - Adds cached_client method in BaseConnection [#371](https://github.com/inspec/train/pull/371) ([dmccown](https://github.com/dmccown))
5
+ - Pass logger to Cisco IOS transport [#381](https://github.com/inspec/train/pull/381) ([btm](https://github.com/btm))
6
6
  <!-- latest_release -->
7
7
 
8
- <!-- release_rollup since=1.5.4 -->
9
- ### Changes since 1.5.4 release
8
+ <!-- release_rollup since=1.5.6 -->
9
+ ### Changes since 1.5.6 release
10
10
 
11
11
  #### Merged Pull Requests
12
- - Adds cached_client method in BaseConnection [#371](https://github.com/inspec/train/pull/371) ([dmccown](https://github.com/dmccown)) <!-- 1.5.6 -->
13
- - Fix Cisco IOS detection when banners lack a `\r\n` [#372](https://github.com/inspec/train/pull/372) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 1.5.5 -->
12
+ - Pass logger to Cisco IOS transport [#381](https://github.com/inspec/train/pull/381) ([btm](https://github.com/btm)) <!-- 1.5.11 -->
13
+ - Added a new matcher for amazon linux 2 [#380](https://github.com/inspec/train/pull/380) ([artyomtkachenko](https://github.com/artyomtkachenko)) <!-- 1.5.10 -->
14
+ - Remove `#local?` [#365](https://github.com/inspec/train/pull/365) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 1.5.9 -->
15
+ - Fix shallow_link_path on remote unix [#373](https://github.com/inspec/train/pull/373) ([mheiges](https://github.com/mheiges)) <!-- 1.5.8 -->
16
+ - Add Google API application info [#378](https://github.com/inspec/train/pull/378) ([nathenharvey](https://github.com/nathenharvey)) <!-- 1.5.7 -->
14
17
  <!-- release_rollup -->
15
18
 
16
19
  <!-- latest_stable_release -->
20
+ ## [v1.5.6](https://github.com/inspec/train/tree/v1.5.6) (2018-11-01)
21
+
22
+ #### Merged Pull Requests
23
+ - Fix Cisco IOS detection when banners lack a `\r\n` [#372](https://github.com/inspec/train/pull/372) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
24
+ - Adds cached_client method in BaseConnection [#371](https://github.com/inspec/train/pull/371) ([dmccown](https://github.com/dmccown))
25
+ <!-- latest_stable_release -->
26
+
17
27
  ## [v1.5.4](https://github.com/inspec/train/tree/v1.5.4) (2018-10-18)
18
28
 
19
29
  #### Merged Pull Requests
@@ -21,7 +31,6 @@
21
31
  - Remove the legacy version bumping from the rakefile [#359](https://github.com/inspec/train/pull/359) ([tas50](https://github.com/tas50))
22
32
  - Adds Azure Vault Client [#351](https://github.com/inspec/train/pull/351) ([r-fennell](https://github.com/r-fennell))
23
33
  - Correct example plugin link [#363](https://github.com/inspec/train/pull/363) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
24
- <!-- latest_stable_release -->
25
34
 
26
35
  ## [v1.5.0](https://github.com/inspec/train/tree/v1.5.0) (2018-09-27)
27
36
 
@@ -62,7 +62,8 @@ module Train
62
62
 
63
63
  def shallow_link_path
64
64
  return nil unless symlink?
65
- @shallow_link_path ||= ::File.readlink(@path)
65
+ @shallow_link_path ||=
66
+ @backend.run_command("readlink #{@spath}").stdout.chomp
66
67
  end
67
68
 
68
69
  def unix_mode_mask(owner, type)
@@ -10,8 +10,8 @@ module Train::Platforms::Detect::Helpers
10
10
  case conf
11
11
  when /rawhide/i
12
12
  /((\d+) \(Rawhide\))/i.match(conf)[1].downcase
13
- when /Amazon Linux AMI/i
14
- /release ([\d\.]+)/.match(conf)[1]
13
+ when /Amazon Linux/i
14
+ /([\d\.]+)/.match(conf)[1]
15
15
  when /derived from .*linux|amazon/i
16
16
  /Linux ((\d+|\.)+)/i.match(conf)[1]
17
17
  else
@@ -17,9 +17,15 @@ module Train::Platforms::Detect::Specifications
17
17
 
18
18
  plat.family('windows').in_family('os')
19
19
  .detect {
20
- if winrm? || (@backend.local? && ruby_host_os(/mswin|mingw32|windows/))
21
- true
20
+ # Can't return from a `proc` thus the `is_windows` shenanigans
21
+ is_windows = false
22
+ is_windows = true if winrm?
23
+
24
+ if @backend.class.to_s == 'Train::Transports::Local::Connection'
25
+ is_windows = true if ruby_host_os(/mswin|mingw32|windows/)
22
26
  end
27
+
28
+ is_windows
23
29
  }
24
30
  # windows platform
25
31
  plat.name('windows').in_family('windows')
@@ -91,11 +91,6 @@ class Train::Plugins::Transport
91
91
  end
92
92
  end
93
93
 
94
- # Is this a local transport?
95
- def local?
96
- false
97
- end
98
-
99
94
  def force_platform!(name, platform_details = nil)
100
95
  plat = Train::Platforms.name(name)
101
96
  plat.backend = self
@@ -7,8 +7,6 @@ class Train::Transports::SSH
7
7
  def initialize(options)
8
8
  super(options)
9
9
 
10
- logger.level = Logger::INFO
11
-
12
10
  # Extract options to avoid passing them in to `Net::SSH.start` later
13
11
  @host = options.delete(:host)
14
12
  @user = options.delete(:user)
@@ -88,6 +88,8 @@ module Train::Transports
88
88
  scopes = ['https://www.googleapis.com/auth/cloud-platform',
89
89
  'https://www.googleapis.com/auth/compute']
90
90
  authorization = Google::Auth.get_application_default(scopes)
91
+ Google::Apis::ClientOptions.default.application_name = 'chef-inspec-train'
92
+ Google::Apis::ClientOptions.default.application_version = Train::VERSION
91
93
  Google::Apis::RequestOptions.default.authorization = authorization
92
94
  end
93
95
 
@@ -28,10 +28,6 @@ module Train::Transports
28
28
  end
29
29
  end
30
30
 
31
- def local?
32
- true
33
- end
34
-
35
31
  def login_command
36
32
  nil # none, open your shell
37
33
  end
@@ -218,6 +218,7 @@ module Train::Transports
218
218
  # We will also support the sudo password field for the same purpose
219
219
  # for the interim. # TODO
220
220
  ios_options[:enable_password] = @options[:enable_password] || @options[:sudo_password]
221
+ ios_options[:logger] = @options[:logger]
221
222
  ios_options.merge!(@connection_options)
222
223
  conn = CiscoIOSConnection.new(ios_options)
223
224
  end
@@ -69,10 +69,6 @@ module Train::Transports
69
69
  end
70
70
  end
71
71
 
72
- def local?
73
- true
74
- end
75
-
76
72
  def platform
77
73
  force_platform!('vmware', @platform_details)
78
74
  end
@@ -3,5 +3,5 @@
3
3
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
4
4
 
5
5
  module Train
6
- VERSION = '1.5.6'.freeze
6
+ VERSION = '1.5.11'.freeze
7
7
  end
@@ -10,10 +10,6 @@ module TrainPlugins
10
10
  super(options)
11
11
  end
12
12
 
13
- def local?
14
- true
15
- end
16
-
17
13
  private
18
14
 
19
15
  def run_command_via_connection(cmd)
@@ -28,6 +28,14 @@ describe 'os_linux' do
28
28
  it 'normal linux' do
29
29
  detector.redhatish_version('derived from Ubuntu Linux 11').must_equal('11')
30
30
  end
31
+
32
+ it 'amazon linux 2 new release naming schema' do
33
+ detector.redhatish_version('Amazon Linux release 2 (Karoo)').must_equal('2')
34
+ end
35
+
36
+ it 'amazon linux 2 old release naming schema' do
37
+ detector.redhatish_version('Amazon Linux 2').must_equal('2')
38
+ end
31
39
  end
32
40
 
33
41
  describe 'lsb parse' do
@@ -99,6 +99,18 @@ describe 'gcp transport' do
99
99
  client.is_a?(Google::Apis::ComputeV1::ComputeService).must_equal true
100
100
  cache[:api_call].count.must_equal 0
101
101
  end
102
+
103
+ it 'test gcp_compute_client application name' do
104
+ client = connection.gcp_compute_client
105
+ client.is_a?(Google::Apis::ComputeV1::ComputeService).must_equal true
106
+ client.client_options.application_name.must_equal 'chef-inspec-train'
107
+ end
108
+
109
+ it 'test gcp_compute_client application version' do
110
+ client = connection.gcp_compute_client
111
+ client.is_a?(Google::Apis::ComputeV1::ComputeService).must_equal true
112
+ client.client_options.application_version.must_equal Train::VERSION
113
+ end
102
114
  end
103
115
 
104
116
  describe 'gcp_iam_client' do
@@ -114,6 +126,18 @@ describe 'gcp transport' do
114
126
  client.is_a?(Google::Apis::IamV1::IamService).must_equal true
115
127
  cache[:api_call].count.must_equal 0
116
128
  end
129
+
130
+ it 'test gcp_iam_client application name' do
131
+ client = connection.gcp_iam_client
132
+ client.is_a?(Google::Apis::IamV1::IamService).must_equal true
133
+ client.client_options.application_name.must_equal 'chef-inspec-train'
134
+ end
135
+
136
+ it 'test gcp_iam_client application version' do
137
+ client = connection.gcp_iam_client
138
+ client.is_a?(Google::Apis::IamV1::IamService).must_equal true
139
+ client.client_options.application_version.must_equal Train::VERSION
140
+ end
117
141
  end
118
142
 
119
143
  describe 'gcp_project_client' do
@@ -129,6 +153,18 @@ describe 'gcp transport' do
129
153
  client.is_a?(Google::Apis::CloudresourcemanagerV1::CloudResourceManagerService).must_equal true
130
154
  cache[:api_call].count.must_equal 0
131
155
  end
156
+
157
+ it 'test gcp_project_client application name' do
158
+ client = connection.gcp_project_client
159
+ client.is_a?(Google::Apis::CloudresourcemanagerV1::CloudResourceManagerService).must_equal true
160
+ client.client_options.application_name.must_equal 'chef-inspec-train'
161
+ end
162
+
163
+ it 'test gcp_project_client application version' do
164
+ client = connection.gcp_project_client
165
+ client.is_a?(Google::Apis::CloudresourcemanagerV1::CloudResourceManagerService).must_equal true
166
+ client.client_options.application_version.must_equal Train::VERSION
167
+ end
132
168
  end
133
169
 
134
170
  describe 'gcp_storage_client' do
@@ -144,6 +180,18 @@ describe 'gcp transport' do
144
180
  client.is_a?(Google::Apis::StorageV1::StorageService).must_equal true
145
181
  cache[:api_call].count.must_equal 0
146
182
  end
183
+
184
+ it 'test gcp_storage_client application name' do
185
+ client = connection.gcp_storage_client
186
+ client.is_a?(Google::Apis::StorageV1::StorageService).must_equal true
187
+ client.client_options.application_name.must_equal 'chef-inspec-train'
188
+ end
189
+
190
+ it 'test gcp_storage_client application version' do
191
+ client = connection.gcp_storage_client
192
+ client.is_a?(Google::Apis::StorageV1::StorageService).must_equal true
193
+ client.client_options.application_version.must_equal Train::VERSION
194
+ end
147
195
  end
148
196
 
149
197
  describe 'gcp_admin_client' do
@@ -159,6 +207,18 @@ describe 'gcp transport' do
159
207
  client.is_a?(Google::Apis::AdminDirectoryV1::DirectoryService).must_equal true
160
208
  cache[:api_call].count.must_equal 0
161
209
  end
210
+
211
+ it 'test gcp_admin_client application name' do
212
+ client = connection.gcp_admin_client
213
+ client.is_a?(Google::Apis::AdminDirectoryV1::DirectoryService).must_equal true
214
+ client.client_options.application_name.must_equal 'chef-inspec-train'
215
+ end
216
+
217
+ it 'test gcp_admin_client application version' do
218
+ client = connection.gcp_admin_client
219
+ client.is_a?(Google::Apis::AdminDirectoryV1::DirectoryService).must_equal true
220
+ client.client_options.application_version.must_equal Train::VERSION
221
+ end
162
222
  end
163
223
 
164
224
  # test options override of env vars in connect
@@ -127,12 +127,6 @@ describe 'Train::Transports::VMware::Connection' do
127
127
  end
128
128
  end
129
129
 
130
- describe '#local' do
131
- it 'returns true' do
132
- create_transport.connection.local?.must_equal true
133
- end
134
- end
135
-
136
130
  describe '#platform' do
137
131
  it 'returns correct platform details' do
138
132
  platform = create_transport.connection.platform
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: 1.5.6
4
+ version: 1.5.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Richter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-01 00:00:00.000000000 Z
11
+ date: 2018-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json