inspec 1.28.1 → 1.29.0

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: 07e85e45e04bc18a16384094f928312ced530555
4
- data.tar.gz: a7212297dbebbfff82d361783023260b691e3241
3
+ metadata.gz: a517bb883e12e171576ca6d64da4005fc89eb117
4
+ data.tar.gz: '04879fa4af63f6e2274b2965d1167bc5971c9b59'
5
5
  SHA512:
6
- metadata.gz: 1441aca0a41c7282725538090d035951afc2182e477028fa3ae6b6acd79c7773cced561a2d249fdb63875ab955653b728e28fd7b0f84795ffa3e4a0d123b0727
7
- data.tar.gz: 6785041126e8b742e273209e9bcfe2c62884433157266832169741f4a4a548c421767f75e6f3dc42ab1fc3489d24adc1f650c78669bcf39e8baaa3f706acd47d
6
+ metadata.gz: f97bd24162ff420b55122fdfe53abecdb06085d2fce6dddbea87eb47f140e30785e1d607ddd081dcf45a0ed3ff11112a9a48eca02ed2c22d2b6023492cc9294a
7
+ data.tar.gz: 20b0a7c4dc401b382d99c9bbb6c691bf4ffbbe147dda7c1d2e24076a851ed746b3bbf89539b12a1329cec87f8fe04c2e8f699fb736d31478b2bf53d92f736b4f
data/CHANGELOG.md CHANGED
@@ -1,8 +1,21 @@
1
1
  # Change Log
2
2
 
3
+ ## [v1.29.0](https://github.com/chef/inspec/tree/v1.29.0) (2017-06-22)
4
+ [Full Changelog](https://github.com/chef/inspec/compare/v1.28.1...v1.29.0)
5
+
6
+ **Fixed bugs:**
7
+
8
+ - Don't send HTTP headers that have nil values [\#1948](https://github.com/chef/inspec/pull/1948) ([adamleff](https://github.com/adamleff))
9
+ - small typo in the postgres resource with exist? function and assignment of data\_dir\_loc. [\#1937](https://github.com/chef/inspec/pull/1937) ([aaronlippold](https://github.com/aaronlippold))
10
+ - reject `nil` as a command input [\#1863](https://github.com/chef/inspec/pull/1863) ([arlimus](https://github.com/arlimus))
11
+
3
12
  ## [v1.28.1](https://github.com/chef/inspec/tree/v1.28.1) (2017-06-16)
4
13
  [Full Changelog](https://github.com/chef/inspec/compare/v1.28.0...v1.28.1)
5
14
 
15
+ **Implemented enhancements:**
16
+
17
+ - Adding toml resource [\#1924](https://github.com/chef/inspec/pull/1924) ([nsdavidson](https://github.com/nsdavidson))
18
+
6
19
  **Fixed bugs:**
7
20
 
8
21
  - Update zlib to 1.2.11 to address known CVEs [\#1934](https://github.com/chef/inspec/issues/1934)
data/lib/fetchers/url.rb CHANGED
@@ -143,21 +143,6 @@ module Fetchers
143
143
  def download_archive_to_temp
144
144
  return @temp_archive_path if ! @temp_archive_path.nil?
145
145
  Inspec::Log.debug("Fetching URL: #{@target}")
146
- http_opts = {}
147
- http_opts['ssl_verify_mode'.to_sym] = OpenSSL::SSL::VERIFY_NONE if @insecure
148
- if @config
149
- if @config['server_type'] == 'automate'
150
- http_opts['chef-delivery-enterprise'] = @config['automate']['ent']
151
- if @config['automate']['token_type'] == 'dctoken'
152
- http_opts['x-data-collector-token'] = @config['token']
153
- else
154
- http_opts['chef-delivery-user'] = @config['user']
155
- http_opts['chef-delivery-token'] = @config['token']
156
- end
157
- elsif @token
158
- http_opts['Authorization'] = "Bearer #{@token}"
159
- end
160
- end
161
146
  remote = open(@target, http_opts)
162
147
  @archive_type = file_type_from_remote(remote) # side effect :(
163
148
  archive = Tempfile.new(['inspec-dl-', @archive_type])
@@ -178,5 +163,42 @@ module Fetchers
178
163
  @temp_archive_path = nil
179
164
  final_path
180
165
  end
166
+
167
+ def http_opts
168
+ opts = {}
169
+ opts[:ssl_verify_mode] = OpenSSL::SSL::VERIFY_NONE if @insecure
170
+
171
+ if @config['server_type'] == 'automate'
172
+ opts['chef-delivery-enterprise'] = @config['automate']['ent']
173
+ if @config['automate']['token_type'] == 'dctoken'
174
+ opts['x-data-collector-token'] = @config['token']
175
+ else
176
+ opts['chef-delivery-user'] = @config['user']
177
+ opts['chef-delivery-token'] = @config['token']
178
+ end
179
+ elsif @token
180
+ opts['Authorization'] = "Bearer #{@token}"
181
+ end
182
+
183
+ # Do not send any headers that have nil values.
184
+ # Net::HTTP does not gracefully handle this situation.
185
+ check_for_missing_values!(opts)
186
+
187
+ opts
188
+ end
189
+
190
+ def check_for_missing_values!(opts)
191
+ keys_missing_values = opts.keys.delete_if do |k|
192
+ if opts[k].nil?
193
+ false
194
+ elsif opts[k].respond_to?(:empty?) && opts[k].empty?
195
+ false
196
+ else
197
+ true
198
+ end
199
+ end
200
+ raise 'Unable to fetch profile - the following HTTP headers have no value: ' \
201
+ "#{keys_missing_values.join(', ')}" unless keys_missing_values.empty?
202
+ end
181
203
  end
182
204
  end
@@ -4,5 +4,5 @@
4
4
  # author: Christoph Hartmann
5
5
 
6
6
  module Inspec
7
- VERSION = '1.28.1'.freeze
7
+ VERSION = '1.29.0'.freeze
8
8
  end
@@ -24,6 +24,9 @@ module Inspec::Resources
24
24
  attr_reader :command
25
25
 
26
26
  def initialize(cmd)
27
+ if cmd.nil?
28
+ raise 'InSpec `command` was called with `nil` as the argument. This is not supported. Please provide a valid command instead.'
29
+ end
27
30
  @command = cmd
28
31
  end
29
32
 
@@ -75,7 +75,7 @@ module Inspec::Resources
75
75
  ]
76
76
 
77
77
  dir_list.each do |dir|
78
- data_dir_loc if inspec.directory(dir).exists?
78
+ data_dir_loc = dir if inspec.directory(dir).exist?
79
79
  break
80
80
  end
81
81
 
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: 1.28.1
4
+ version: 1.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Richter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-16 00:00:00.000000000 Z
11
+ date: 2017-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: train