train 1.4.0 → 1.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f666a5aa2bb040f3bc662ef2881d2a3778764cc9
4
- data.tar.gz: 6e84e3102772ea858d8f4827f959e74f0d7a396f
3
+ metadata.gz: f63093de8fc4481a4c9138635607941fc2c58d79
4
+ data.tar.gz: 6cb07cade32d161a378fbd65e01deda7e6601b73
5
5
  SHA512:
6
- metadata.gz: 376156ec17342f41fb82f5a1e8888e1c19b31f8760fd0ceaed4b664f68acf54c759129d3a458c0343c19d0925c70a09f715d1c8f18171d82b506c6ab331267f9
7
- data.tar.gz: 5bce1e60af8264a419c68898e8efca072e0f5004313a9aabb1b83a978956618e21d6d3bc9de9ee848a93b482bfe6ec751d713bda18035074814b15294d5502da
6
+ metadata.gz: cc3669cede169bc9b1d6279ad131e6f530e5030f5eec62cff45fd3ed67db8fb9110c3290fc2da2cc0a60bfca8bd7a6f6e94139679e48b2e95833dac91bfa2d13
7
+ data.tar.gz: ea3b12df05af8e99a3999d379e67460f1d01f3c06217c6c4b2a28fc7e9e389319092c204ab5de0910a5c3f90aeb334657e421d73147bf02934ff3f96745a0874
@@ -1,7 +1,15 @@
1
1
  # Change Log
2
2
 
3
- ## [1.4.0](https://github.com/chef/train/tree/1.4.0) (2018-04-12)
4
- [Full Changelog](https://github.com/chef/train/compare/v1.3.0...1.4.0)
3
+ ## [1.4.1](https://github.com/chef/train/tree/1.4.1) (2018-04-19)
4
+ [Full Changelog](https://github.com/chef/train/compare/v1.4.0...1.4.1)
5
+
6
+ **Merged pull requests:**
7
+
8
+ - Add UUID for Cisco IOS and Nexus devices [\#285](https://github.com/chef/train/pull/285) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
9
+ - Add handling for privileged exec mode [\#284](https://github.com/chef/train/pull/284) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
10
+
11
+ ## [v1.4.0](https://github.com/chef/train/tree/v1.4.0) (2018-04-12)
12
+ [Full Changelog](https://github.com/chef/train/compare/v1.3.0...v1.4.0)
5
13
 
6
14
  **Closed issues:**
7
15
 
@@ -9,6 +17,7 @@
9
17
 
10
18
  **Merged pull requests:**
11
19
 
20
+ - Release 1.4.0 [\#282](https://github.com/chef/train/pull/282) ([jquick](https://github.com/jquick))
12
21
  - Add CloudLinux as a detected platform [\#281](https://github.com/chef/train/pull/281) ([tarcinil](https://github.com/tarcinil))
13
22
  - Move Cisco IOS connection under SSH transport [\#279](https://github.com/chef/train/pull/279) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
14
23
  - Initialize FileManager using '@service' [\#278](https://github.com/chef/train/pull/278) ([marcparadise](https://github.com/marcparadise))
@@ -555,6 +555,7 @@ module Train::Platforms::Detect::Specifications
555
555
  next unless v[:type] == 'nexus'
556
556
  @platform[:release] = v[:version]
557
557
  @platform[:arch] = nil
558
+ @platform[:uuid_command] = 'show inventory chassis | include SN'
558
559
  true
559
560
  }
560
561
 
@@ -23,6 +23,13 @@ class Train::Transports::SSH
23
23
  "ssh://#{@user}@#{@host}:#{@port}"
24
24
  end
25
25
 
26
+ def unique_identifier
27
+ result = run_command_via_connection('show inventory').stdout
28
+ result.split("\r\n\r\n").each do |section|
29
+ return section.split('SN: ')[1].strip if section.include?('Chassis')
30
+ end
31
+ end
32
+
26
33
  private
27
34
 
28
35
  def establish_connection
@@ -38,7 +45,11 @@ class Train::Transports::SSH
38
45
 
39
46
  # Escalate privilege to enable mode if password is given
40
47
  if @enable_password
41
- run_command_via_connection("enable\r\n#{@enable_password}")
48
+ # This verifies we are not in privileged exec mode before running the
49
+ # enable command. Otherwise, the password will be in history.
50
+ if run_command_via_connection('show privilege').stdout.split[-1] != '15'
51
+ run_command_via_connection("enable\r\n#{@enable_password}")
52
+ end
42
53
  end
43
54
 
44
55
  # Prevent `--MORE--` by removing terminal length limit
@@ -3,5 +3,5 @@
3
3
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
4
4
 
5
5
  module Train
6
- VERSION = '1.4.0'.freeze
6
+ VERSION = '1.4.1'.freeze
7
7
  end
@@ -31,6 +31,16 @@ describe 'CiscoIOSConnection' do
31
31
  end
32
32
  end
33
33
 
34
+ describe '#unique_identifier' do
35
+ it 'returns the correct identifier' do
36
+ output = "NAME: \"Chassis\", DESCR: \"Cisco 7206VXR, 6-slot chassis\"\r\nPID: CISCO7206VXR , VID: , SN: 4279256517 \r\n\r\nNAME: \"NPE400 0\", DESCR: \"Cisco 7200VXR Network Processing Engine NPE-400\"\r\nPID: NPE-400 , VID: , SN: 11111111 \r\n\r\nNAME: \"module 0\", DESCR: \"I/O FastEthernet (TX-ISL)\"\r\nPID: C7200-IO-FE-MII/RJ45=, VID: , SN: 4294967295 \r\n\r\nNAME: \"Power Supply 1\", DESCR: \"Cisco 7200 AC Power Supply\"\r\nPID: PWR-7200-AC , VID: , SN: \r\n\r\nNAME: \"Power Supply 2\", DESCR: \"Cisco 7200 AC Power Supply\"\r\nPID: PWR-7200-AC , VID: , SN: "
37
+ Train::Transports::SSH::CiscoIOSConnection.any_instance
38
+ .expects(:run_command_via_connection).with('show inventory')
39
+ .returns(OpenStruct.new(stdout: output))
40
+ connection.unique_identifier.must_equal('4279256517')
41
+ end
42
+ end
43
+
34
44
  describe '#format_result' do
35
45
  it 'returns correctly when result is `good`' do
36
46
  output = 'good'
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.4.0
4
+ version: 1.4.1
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-04-12 00:00:00.000000000 Z
11
+ date: 2018-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json