train-core 3.8.9 → 3.9.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
  SHA256:
3
- metadata.gz: edb9b675408e81e6b24133e0fa0a859d19f727091fda4a93a7b16691addb20cf
4
- data.tar.gz: 628ff896313d2ad8113a01c018864840fc341f2239246c85e8d2c47a921354fb
3
+ metadata.gz: 2d3eabbefcf1adac9f0d1142143709c390d4bac2b480ea26ab2b54b290d4c94b
4
+ data.tar.gz: dd7f3e0edf4f7c0fad07582d2bf895578b31ebd1cba881bb6e5e7b32c9f312fb
5
5
  SHA512:
6
- metadata.gz: d37f24464d367c55bfa73f285804b2428203219452a04d58bab4623adff91bc834ea4e27a1a1eb67aa813b3ab99ea4a16cecbe805dd92125e5f8df3e4308862f
7
- data.tar.gz: 853c5858f859944c9e5b0777191d370ed062441986af9ab86e86b532188145dd1df55a1fc0ffea4cd6113545420783f3f489eb0a8e6db50851a5a6d2ebc4765e
6
+ metadata.gz: 91b758fd870fd5c4f32672a7e671d468fced308acc7f58754204e4e9beaa4baba6c798c25215c8112ed438ef0a5910725af4dcff1764a322d917f343af38996c
7
+ data.tar.gz: 48ccaea241788cf7d9aa7a682348781755a4e3cefcf95ae7134c8ede4b273acdc95eb2de109a5a169a00fc527364d74757c0506a98bef75cff44f786957f52c9
@@ -97,6 +97,12 @@ module Train::Platforms::Detect::Helpers
97
97
  return @cache[:cisco] = { version: m[2], model: m[1], type: "ios-xe" }
98
98
  end
99
99
 
100
+ # CSR 1000V (for example) does not specify model
101
+ m = res.match(/Cisco IOS XE Software, Version (\d+\.\d+\.\d+[A-Z]*)/)
102
+ unless m.nil?
103
+ return @cache[:cisco] = { version: m[1], type: "ios-xe" }
104
+ end
105
+
100
106
  m = res.match(/Cisco Nexus Operating System \(NX-OS\) Software/)
101
107
  unless m.nil?
102
108
  v = res[/^\s*system:\s+version (\d+\.\d+)/, 1]
@@ -326,7 +326,16 @@ class Train::Transports::SSH
326
326
  cmd = @cmd_wrapper.run(cmd) if @cmd_wrapper
327
327
 
328
328
  # Timeout the command if requested and able
329
- cmd = "timeout #{timeout}s #{cmd}" if timeout && timeoutable?(cmd)
329
+ if timeout && timeoutable?(cmd)
330
+ # if cmd start with sudo then we need to make sure the timeout should be prepend with sudo else actual timeout is not working.
331
+ if cmd.strip.split[0] == "sudo"
332
+ split_cmd = cmd.strip.split
333
+ split_cmd[0] = "sudo timeout #{timeout}s"
334
+ cmd = split_cmd.join(" ")
335
+ else
336
+ cmd = "timeout #{timeout}s #{cmd}"
337
+ end
338
+ end
330
339
 
331
340
  logger.debug("[SSH] #{self} cmd = #{cmd}")
332
341
 
data/lib/train/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
3
3
 
4
4
  module Train
5
- VERSION = "3.8.9".freeze
5
+ VERSION = "3.9.2".freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: train-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.9
4
+ version: 3.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef InSpec Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-09 00:00:00.000000000 Z
11
+ date: 2022-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable