train-core 1.4.35 → 1.4.37

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: 7abd9673c744cac7ee9f149c274b1ca9d19b9da890f8c89181871a0dc0aea4d8
4
- data.tar.gz: 0d911af4ab8c1836e4fb33e43643c9af3b0fa5bbd7e94efe4f92e0f647c7e275
3
+ metadata.gz: b0fecf56a30d1bc44bb697bea734e04826b59214eb8e4340ea5adfd2890b2f3a
4
+ data.tar.gz: 1370812f4439c523a863ce0fad4652ba0ff30766d41ef02d2b30f6785b202bc5
5
5
  SHA512:
6
- metadata.gz: 8117f493dc84c658994d2906da925fa0300be8c1fcab9bee47093276b324001d65a514c01c82355274565f5d4dad4755788c1a383e713c8934ff3b93e19e41f2
7
- data.tar.gz: 11a2ed9ca480fc4214018c6458c85bdf900ede597ab9d7f29c3341375385f6a9d0f8bbe16985005764b2004dbf9156e10e498b85cae28887283fbeb4ce808345
6
+ metadata.gz: e3a7cbb3c87fa84580a7606a93338a4f53c76e538e969224c5700a814dd9d068db5d1ec50b0466b987c591a0fd9bf2ad59d534773c0618d66ccdabfd7f6e38b1
7
+ data.tar.gz: 56fb9db0f1ca7e9e39decd42c35d725ef2d9eee5e6a3cf1fa960baebea6926d9c5a3d8dbca564cf3d35835a29917f9d51714ca6ded44871060a2c0c56cb4afb0
data/CHANGELOG.md CHANGED
@@ -1,27 +1,33 @@
1
- <!-- latest_release 1.4.35 -->
2
- ## [v1.4.35](https://github.com/inspec/train/tree/v1.4.35) (2018-08-23)
1
+ <!-- latest_release 1.4.37 -->
2
+ ## [v1.4.37](https://github.com/inspec/train/tree/v1.4.37) (2018-09-13)
3
3
 
4
4
  #### Merged Pull Requests
5
- - Adds connection to Graph RBAC API [#327](https://github.com/inspec/train/pull/327) ([r-fennell](https://github.com/r-fennell))
5
+ - Add a export method for platforms [#347](https://github.com/inspec/train/pull/347) ([jquick](https://github.com/jquick))
6
6
  <!-- latest_release -->
7
7
 
8
- <!-- release_rollup since=1.4.31 -->
9
- ### Changes since 1.4.31 release
8
+ <!-- release_rollup since=1.4.35 -->
9
+ ### Changes since 1.4.35 release
10
10
 
11
11
  #### Merged Pull Requests
12
- - Adds connection to Graph RBAC API [#327](https://github.com/inspec/train/pull/327) ([r-fennell](https://github.com/r-fennell)) <!-- 1.4.35 -->
13
- - Fixes failing test when you have a cred file [#343](https://github.com/inspec/train/pull/343) ([dmccown](https://github.com/dmccown)) <!-- 1.4.34 -->
14
- - Modify Cisco UUID detection to use processor ID [#342](https://github.com/inspec/train/pull/342) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 1.4.33 -->
15
- - Ensure unique_identifier returns something meaningful for service acc… [#338](https://github.com/inspec/train/pull/338) ([skpaterson](https://github.com/skpaterson)) <!-- 1.4.32 -->
12
+ - Add a export method for platforms [#347](https://github.com/inspec/train/pull/347) ([jquick](https://github.com/jquick)) <!-- 1.4.37 -->
13
+ - Rescues SystemCallError instead of Errno [#346](https://github.com/inspec/train/pull/346) ([dmccown](https://github.com/dmccown)) <!-- 1.4.36 -->
16
14
  <!-- release_rollup -->
17
15
 
18
16
  <!-- latest_stable_release -->
17
+ ## [v1.4.35](https://github.com/inspec/train/tree/v1.4.35) (2018-08-23)
18
+
19
+ #### Merged Pull Requests
20
+ - Ensure unique_identifier returns something meaningful for service acc… [#338](https://github.com/inspec/train/pull/338) ([skpaterson](https://github.com/skpaterson))
21
+ - Modify Cisco UUID detection to use processor ID [#342](https://github.com/inspec/train/pull/342) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
22
+ - Fixes failing test when you have a cred file [#343](https://github.com/inspec/train/pull/343) ([dmccown](https://github.com/dmccown))
23
+ - Adds connection to Graph RBAC API [#327](https://github.com/inspec/train/pull/327) ([r-fennell](https://github.com/r-fennell))
24
+ <!-- latest_stable_release -->
25
+
19
26
  ## [v1.4.31](https://github.com/inspec/train/tree/v1.4.31) (2018-08-17)
20
27
 
21
28
  #### Merged Pull Requests
22
29
  - Fixes an issue where the credential file was nil [#337](https://github.com/inspec/train/pull/337) ([dmccown](https://github.com/dmccown))
23
30
  - Enable using rubygems as plugins [#335](https://github.com/inspec/train/pull/335) ([clintoncwolfe](https://github.com/clintoncwolfe))
24
- <!-- latest_stable_release -->
25
31
 
26
32
  ## [v1.4.29](https://github.com/inspec/train/tree/v1.4.29) (2018-08-15)
27
33
 
@@ -24,6 +24,12 @@ module Train::Platforms
24
24
  def families
25
25
  @families ||= {}
26
26
  end
27
+
28
+ # Clear all platform settings. Only used for testing.
29
+ def __reset
30
+ @list = {}
31
+ @families = {}
32
+ end
27
33
  end
28
34
 
29
35
  # Create or update a platform
@@ -81,4 +87,16 @@ module Train::Platforms
81
87
  print_children(obj, pad + 2) if defined?(obj.children) && !obj.children.nil?
82
88
  end
83
89
  end
90
+
91
+ def self.export
92
+ export = []
93
+ list.each do |name, platform|
94
+ platform.find_family_hierarchy
95
+ export << {
96
+ name: name,
97
+ families: platform.family_hierarchy,
98
+ }
99
+ end
100
+ export.sort_by { |platform| platform[:name] }
101
+ end
84
102
  end
@@ -22,6 +22,14 @@ module Train::Platforms
22
22
  @families.collect { |k, _v| k.name }
23
23
  end
24
24
 
25
+ def find_family_hierarchy(platform = self)
26
+ families = platform.families.each_with_object([]) do |(k, _v), memo|
27
+ memo << k.name
28
+ memo << find_family_hierarchy(k) unless k.families.empty?
29
+ end
30
+ @family_hierarchy = families.flatten
31
+ end
32
+
25
33
  def family
26
34
  @platform[:family] || @family_hierarchy[0]
27
35
  end
@@ -81,20 +81,13 @@ class Train::Plugins::Transport
81
81
  plat = Train::Platforms.name(name)
82
82
  plat.backend = self
83
83
  plat.platform = platform_details unless platform_details.nil?
84
- plat.family_hierarchy = family_hierarchy(plat).flatten
84
+ plat.find_family_hierarchy
85
85
  plat.add_platform_methods
86
86
  plat
87
87
  end
88
88
 
89
89
  alias direct_platform force_platform!
90
90
 
91
- def family_hierarchy(plat)
92
- plat.families.each_with_object([]) do |(k, _v), memo|
93
- memo << k.name
94
- memo << family_hierarchy(k) unless k.families.empty?
95
- end
96
- end
97
-
98
91
  # Get information on the operating system which this transport connects to.
99
92
  #
100
93
  # @return [Platform] system information
@@ -77,7 +77,7 @@ class Train::Transports::Mock
77
77
  value = { name: 'mock', family: 'mock', release: 'unknown', arch: 'unknown' }.merge(value)
78
78
 
79
79
  platform = Train::Platforms.name(value[:name])
80
- platform.family_hierarchy = family_hierarchy(platform).flatten
80
+ platform.find_family_hierarchy
81
81
  platform.platform = value
82
82
  platform.add_platform_methods
83
83
  @platform = platform
data/lib/train/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
4
4
 
5
5
  module Train
6
- VERSION = '1.4.35'.freeze
6
+ VERSION = '1.4.37'.freeze
7
7
  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: 1.4.35
4
+ version: 1.4.37
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-08-23 00:00:00.000000000 Z
11
+ date: 2018-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout