inspec 0.19.2 → 0.19.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YWU1MWE2NmFhMTQ0ODNhZDc2Zjk1YmM2OWNhNzdjNGRhYzBjMzllNA==
4
+ Y2RmMzdlYzM1NmRkODlmNDNiZDRjMTg4MTkxZDczOGM4ZWEyMjdmNw==
5
5
  data.tar.gz: !binary |-
6
- NjI5MGVjN2IzM2U4NDczZjU2NGZmZTQxNDJjNTMzN2M3MDc5YTFjMw==
6
+ NjFmODBkODVkMTI5MzljNjk1NzI4MGNjNDZkMzc0YTczODExYjYwMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- N2EzZTRjZjA4ZDJkNTliM2MxNTJhNzNmMGVmODZlMzNkZWNmNWY2YmVkMDhi
10
- MjBlODgzYzc5Njg3MGVjZmQyZjdjNmU4OGYyMGU2MmRhOGYxM2JlN2FjOGUw
11
- Yjc1M2UwMjMwNmQ4N2U4YzRlMWUyOGM3Njc4N2VjYjE5NDgxZDg=
9
+ YzM5Njc4YTc2NTZjNTk0ZTNlYWVlYWU0ZTU3ZGVlNDU2OTA2NWIxZjA5ZDRi
10
+ MjVlYWZhNDViZjU4NmIzNDZkNjcwOThkMWZkZGY2NjU4YjI4MzFlMWU1ZjE0
11
+ MDY0NDZhOGRiODU4YTFmNWExMGYwYzYwZGYxMTI2Nzg0N2U3Y2M=
12
12
  data.tar.gz: !binary |-
13
- OTZkMDUwZGFmZjUxYmU3ZDlhYzQyNDJjMzQ5Y2I1YzUyZDVmZmZiZWU2NDBi
14
- YjZmNzBjMGZiYmUxZTc5NjhhMWE4ZmM5NDZjOTk0YjU5ZDdkZTY0ZTdiOTY4
15
- ZTM1ZGY3Y2EzYzM2ZWI1NDQ0NjAxOTJlMjk3OWU0NDNjOTI2ZWM=
13
+ NGUwMDk1YWFiMmM3ZTNjOGMxY2ZmMjBmYzFmNGIyZWMwYmM4MDNiZWZkYjRm
14
+ YTIzMDkyNjg0ODk1YzllNjJmNDMxMzdhMTUyZmQxZTYwMWIwNDVlYTJmNTQ0
15
+ ZWUyNzljYjM1NzMzOWFlOWVmOTU4NWE0N2ZhN2FhNTlkODU0N2E=
@@ -1,7 +1,18 @@
1
1
  # Change Log
2
2
 
3
- ## [0.19.2](https://github.com/chef/inspec/tree/0.19.2) (2016-04-21)
4
- [Full Changelog](https://github.com/chef/inspec/compare/v0.19.1...0.19.2)
3
+ ## [0.19.3](https://github.com/chef/inspec/tree/0.19.3) (2016-04-22)
4
+ [Full Changelog](https://github.com/chef/inspec/compare/v0.19.2...0.19.3)
5
+
6
+ **Fixed bugs:**
7
+
8
+ - fix legacy supports call [\#679](https://github.com/chef/inspec/pull/679) ([arlimus](https://github.com/arlimus))
9
+
10
+ **Merged pull requests:**
11
+
12
+ - v0.19.2 [\#675](https://github.com/chef/inspec/pull/675) ([arlimus](https://github.com/arlimus))
13
+
14
+ ## [v0.19.2](https://github.com/chef/inspec/tree/v0.19.2) (2016-04-21)
15
+ [Full Changelog](https://github.com/chef/inspec/compare/v0.19.1...v0.19.2)
5
16
 
6
17
  **Implemented enhancements:**
7
18
 
@@ -137,26 +137,46 @@ module Inspec
137
137
  }
138
138
  end
139
139
 
140
+ def self.finalize_supports_elem(elem, logger)
141
+ case x = elem
142
+ when Hash then x
143
+ when Array
144
+ logger.warn(
145
+ 'Failed to read supports entry that is an array. Please use '\
146
+ 'the `supports: {os-family: xyz}` syntax.',
147
+ )
148
+ nil
149
+ when nil then nil
150
+ else
151
+ logger ||= Logger.new(nil)
152
+ logger.warn(
153
+ "Do not use deprecated `supports: #{x}` syntax. Instead use:\n"\
154
+ "supports:\n - os-family: #{x}\n\n")
155
+ { :'os-family' => x }
156
+ end
157
+ end
158
+
159
+ def self.finalize_supports(supports, logger)
160
+ case x = supports
161
+ when Hash then [x]
162
+ when Array then x.map { |e| finalize_supports_elem(e, logger) }.compact
163
+ when nil then []
164
+ else
165
+ logger ||= Logger.new(nil)
166
+ logger.warn(
167
+ "Do not use deprecated `supports: #{x}` syntax. Instead use:\n"\
168
+ "supports:\n - os-family: #{x}\n\n")
169
+ [{ :'os-family' => x }]
170
+ end
171
+ end
172
+
140
173
  def self.finalize(metadata, profile_id, logger = nil)
141
174
  return nil if metadata.nil?
142
175
  param = metadata.params || {}
143
176
  param['name'] = profile_id.to_s unless profile_id.to_s.empty?
144
177
  param['version'] = param['version'].to_s unless param['version'].nil?
145
178
  metadata.params = symbolize_keys(param)
146
-
147
- # consolidate supports field with legacy mode
148
- metadata.params[:supports] =
149
- case x = metadata.params[:supports]
150
- when Hash then [x]
151
- when Array then x
152
- when nil then []
153
- else
154
- logger ||= Logger.new(nil)
155
- logger.warn(
156
- "Do not use deprecated `supports: #{x}` syntax. Instead use "\
157
- "`supports: {os-family: #{x}}`.")
158
- [{ :'os-family' => x }]
159
- end
179
+ metadata.params[:supports] = finalize_supports(metadata.params[:supports], logger)
160
180
 
161
181
  metadata
162
182
  end
@@ -3,5 +3,5 @@
3
3
  # author: Christoph Hartmann
4
4
 
5
5
  module Inspec
6
- VERSION = '0.19.2'.freeze
6
+ VERSION = '0.19.3'.freeze
7
7
  end
@@ -50,14 +50,20 @@ describe 'metadata with supported operating systems' do
50
50
 
51
51
  it 'supports legacy simple support style, but warns' do
52
52
  # i.e. setting this to something that would fail:
53
- logger.expect :warn, nil, [
54
- 'Do not use deprecated `supports: linux` '\
55
- 'syntax. Instead use `supports: {os-family: linux}`.']
53
+ logger.expect :warn, nil, ["Do not use deprecated `supports: linux` syntax. Instead use:\nsupports:\n - os-family: linux\n\n"]
56
54
  m = supports_meta('linux')
57
55
  m.supports_transport?(backend).must_equal true
58
56
  logger.verify
59
57
  end
60
58
 
59
+ it 'supports legacy simple support style, but warns' do
60
+ # i.e. setting this to something that would fail:
61
+ logger.expect :warn, nil, ["Do not use deprecated `supports: linux` syntax. Instead use:\nsupports:\n - os-family: linux\n\n"]
62
+ m = supports_meta(['linux'])
63
+ m.supports_transport?(backend).must_equal true
64
+ logger.verify
65
+ end
66
+
61
67
  it 'loads a profile which supports os ubuntu' do
62
68
  m = supports_meta({ 'os' => 'ubuntu' })
63
69
  m.supports_transport?(backend).must_equal true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.2
4
+ version: 0.19.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Richter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-21 00:00:00.000000000 Z
11
+ date: 2016-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: r-train
@@ -609,7 +609,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
609
609
  version: '0'
610
610
  requirements: []
611
611
  rubyforge_project:
612
- rubygems_version: 2.4.5
612
+ rubygems_version: 2.4.3
613
613
  signing_key:
614
614
  specification_version: 4
615
615
  summary: Infrastructure and compliance testing.