kitchen-inspec 0.16.1 → 0.17.0

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
  SHA1:
3
- metadata.gz: 63e838bc0d2ff3a02dc378832b89ca238ef16c75
4
- data.tar.gz: 931d2ff55d6d41bb3f0145d2c0d776046005007f
3
+ metadata.gz: 225b906544c971b3981d028d49e555946aff73b7
4
+ data.tar.gz: 2fd9bff33af879f659d95c0b35e43628a3537b37
5
5
  SHA512:
6
- metadata.gz: 60abb7285e5826d23e811dee7997477199ada4ee2a6fc33d6b6701659fc2483887c5f8cb872c75d570479ede90a4c87354fb70e8a50eeda0ba86b3efb9919fea
7
- data.tar.gz: 9debf27c7213f623f4a0008c22073442932ed8d21aae7c89c07043ffbc77fbb8ea78c0057a1a29d3d8410c8514b0e0119ba1cc98a6b3f8242a477ea30382ba1c
6
+ metadata.gz: a42c520d180f2eee16bddf5e7ec7ef21cbd845866dca619cab37aeda0626de30eb220a23ca8d48129e33eda34f93a4d3cd2075f318042bc745bc6ef86670efbc
7
+ data.tar.gz: fdede7e9a33c9cc8e3ad4f581f2eaf794760cbf53b7e629b630de2645cd57f817182cdb16be194e025650733295a9b363d393750a62470107741829bab2af871
data/CHANGELOG.md CHANGED
@@ -1,7 +1,18 @@
1
1
  # Change Log
2
2
 
3
- ## [0.16.1](https://github.com/chef/kitchen-inspec/tree/0.16.1) (2016-11-11)
4
- [Full Changelog](https://github.com/chef/kitchen-inspec/compare/v0.16.0...0.16.1)
3
+ ## [0.17.0](https://github.com/chef/kitchen-inspec/tree/0.17.0) (2016-12-08)
4
+ [Full Changelog](https://github.com/chef/kitchen-inspec/compare/v0.16.1...0.17.0)
5
+
6
+ **Implemented enhancements:**
7
+
8
+ - Support multiple outputs based on platform/test suite variables \(issue 121\) [\#122](https://github.com/chef/kitchen-inspec/pull/122) ([jcastillocano](https://github.com/jcastillocano))
9
+
10
+ **Merged pull requests:**
11
+
12
+ - Tweak logging for clarity [\#123](https://github.com/chef/kitchen-inspec/pull/123) ([tduffield](https://github.com/tduffield))
13
+
14
+ ## [v0.16.1](https://github.com/chef/kitchen-inspec/tree/v0.16.1) (2016-11-11)
15
+ [Full Changelog](https://github.com/chef/kitchen-inspec/compare/v0.16.0...v0.16.1)
5
16
 
6
17
  **Implemented enhancements:**
7
18
 
data/README.md CHANGED
@@ -55,6 +55,19 @@ verifier:
55
55
  port: 22
56
56
  ```
57
57
 
58
+ If you want to customize the output file per platform or test suite
59
+ you can use template format for your output variable. Current flags
60
+ supported:
61
+ * _%{platform}_
62
+ * _%{suite}_
63
+
64
+ ```yaml
65
+ verifier:
66
+ name: inspec
67
+ format: junit
68
+ output: path/to/results/%{platform}_%{suite}_inspec.xml
69
+ ```
70
+
58
71
  ### Directory Structure
59
72
 
60
73
  By default `kitchen-inspec` expects test to be in `test/integration/%suite%` directory structure (we use Chef as provisioner here):
@@ -66,20 +66,31 @@ module Kitchen
66
66
  logger.debug("Initialize InSpec")
67
67
 
68
68
  # gather connection options
69
- opts = runner_options(instance.transport, state)
69
+ opts = runner_options(instance.transport, state, instance.platform.name, instance.suite.name)
70
70
 
71
71
  # add attributes
72
72
  opts[:attrs] = config[:attrs]
73
73
  opts[:attributes] = Hashie.stringify_keys config[:attributes] unless config[:attributes].nil?
74
74
 
75
+ # setup logger
76
+ ::Inspec::Log.init(STDERR)
77
+ ::Inspec::Log.level = Kitchen::Util.from_logger_level(logger.level)
78
+
75
79
  # initialize runner
76
80
  runner = ::Inspec::Runner.new(opts)
77
81
 
78
82
  # add each profile to runner
79
83
  tests = collect_tests
80
- tests.each { |target| runner.add_target(target, opts) }
84
+ profile_ctx = nil
85
+ tests.each do |target|
86
+ profile_ctx = runner.add_target(target, opts)
87
+ end
88
+
89
+ profile_ctx ||= []
90
+ profile_ctx.each do |profile|
91
+ logger.info("Loaded #{profile.name} ")
92
+ end
81
93
 
82
- logger.debug("Running tests from: #{tests.inspect}")
83
94
  exit_code = runner.run
84
95
  return if exit_code == 0
85
96
  raise ActionFailed, "Inspec Runner returns #{exit_code}"
@@ -127,7 +138,6 @@ module Kitchen
127
138
  end
128
139
 
129
140
  base = File.join(base, "inspec") if legacy_mode
130
- logger.info("Using `#{base}` for testing")
131
141
 
132
142
  # only return the directory if it exists
133
143
  Pathname.new(base).exist? ? [{ :path => base }] : []
@@ -159,7 +169,7 @@ module Kitchen
159
169
  #
160
170
  # @return [Hash] a configuration hash of string-based keys
161
171
  # @api private
162
- def runner_options(transport, state = {}) # rubocop:disable Metrics/AbcSize
172
+ def runner_options(transport, state = {}, platform = nil, suite = nil) # rubocop:disable Metrics/AbcSize
163
173
  transport_data = transport.diagnose.merge(state)
164
174
  if transport.is_a?(Kitchen::Transport::Ssh)
165
175
  runner_options_for_ssh(transport_data)
@@ -174,7 +184,7 @@ module Kitchen
174
184
  # default color to true to match InSpec behavior
175
185
  runner_options["color"] = (config[:color].nil? ? true : config[:color])
176
186
  runner_options["format"] = config[:format] unless config[:format].nil?
177
- runner_options["output"] = config[:output] unless config[:output].nil?
187
+ runner_options["output"] = config[:output] % { platform: platform, suite: suite } unless config[:output].nil?
178
188
  runner_options["profiles_path"] = config[:profiles_path] unless config[:profiles_path].nil?
179
189
  end
180
190
  end
@@ -20,6 +20,6 @@
20
20
  module Kitchen
21
21
  module Verifier
22
22
  # Version string for InSpec Kitchen verifier
23
- INSPEC_VERSION = "0.16.1"
23
+ INSPEC_VERSION = "0.17.0"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-inspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.1
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher Nichol
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-11 00:00:00.000000000 Z
11
+ date: 2016-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inspec