inspec 1.7.1 → 1.7.2

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: e6f2f0ca8fb9fe310ac9454e39082d733023a191
4
- data.tar.gz: 84f5a81f485171d490766e9a19dba7ec7c198ea9
3
+ metadata.gz: 8af69e7763f2f41cea47b857805512d1987e8565
4
+ data.tar.gz: 74e15150e9b1f2b6ad90040f3f7e1d07da788e3a
5
5
  SHA512:
6
- metadata.gz: 54b3fb1e15eb187ab7b18f665a7eb15d8faa2f4490862881833899f766a67583152b7c7619e91429dcf71e0ac8273724bbf58567d03c53fe6c387f1f40ed0eeb
7
- data.tar.gz: 08748270838169829e643dcefd85a3a10b0b30a8e2a8f30d5bc188ea7928d141bfdd4fb93d4b7c477c22b26328d8948c01775a11f4e7718e8d60ed685fc35798
6
+ metadata.gz: 615bfc38930bc317de961e0d8d48a4f4f0e7143a010417d8fd3af9db2d62ee0ade358d1e5d182e5d1dcc73c142ec46d14c9bcc4588c4ffde81a98b878418fca6
7
+ data.tar.gz: e40becad8f8b2277293c1bea194863a97b425d2c757f64394a542b264d8ea82cd33a091209d48792202767a0f2c67318b535c760cbfdc0d48ecc9d36e9f183de
@@ -1,7 +1,14 @@
1
1
  # Change Log
2
2
 
3
- ## [1.7.1](https://github.com/chef/inspec/tree/1.7.1) (2016-12-03)
4
- [Full Changelog](https://github.com/chef/inspec/compare/v1.7.0...1.7.1)
3
+ ## [1.7.2](https://github.com/chef/inspec/tree/1.7.2) (2016-12-08)
4
+ [Full Changelog](https://github.com/chef/inspec/compare/v1.7.1...1.7.2)
5
+
6
+ **Fixed bugs:**
7
+
8
+ - use cached profile for compliance dependencies if vendored [\#1348](https://github.com/chef/inspec/pull/1348) ([chris-rock](https://github.com/chris-rock))
9
+
10
+ ## [v1.7.1](https://github.com/chef/inspec/tree/v1.7.1) (2016-12-03)
11
+ [Full Changelog](https://github.com/chef/inspec/compare/v1.7.0...v1.7.1)
5
12
 
6
13
  **Implemented enhancements:**
7
14
 
@@ -13,7 +13,7 @@ module Compliance
13
13
  class Fetcher < Fetchers::Url
14
14
  name 'compliance'
15
15
  priority 500
16
- def self.resolve(target) # rubocop:disable PerceivedComplexity
16
+ def self.resolve(target) # rubocop:disable PerceivedComplexity, Metrics/CyclomaticComplexity
17
17
  uri = if target.is_a?(String) && URI(target).scheme == 'compliance'
18
18
  URI(target)
19
19
  elsif target.respond_to?(:key?) && target.key?(:compliance)
@@ -22,17 +22,22 @@ module Compliance
22
22
 
23
23
  return nil if uri.nil?
24
24
 
25
- # check if we have a compliance token
26
- config = Compliance::Configuration.new
27
- if config['token'].nil?
28
- if config['server_type'] == 'automate'
29
- server = 'automate'
30
- msg = 'inspec compliance login_automate https://your_automate_server --user USER --ent ENT --dctoken DCTOKEN or --usertoken USERTOKEN'
31
- else
32
- server = 'compliance'
33
- msg = "inspec compliance login https://your_compliance_server --user admin --insecure --token 'PASTE TOKEN HERE' "
34
- end
35
- fail Inspec::FetcherFailure, <<EOF
25
+ # we have detailed information available in our lockfile, no need to ask the server
26
+ if target.respond_to?(:key?) && target.key?(:url)
27
+ profile_fetch_url = target[:url]
28
+ config = {}
29
+ else
30
+ # check if we have a compliance token
31
+ config = Compliance::Configuration.new
32
+ if config['token'].nil?
33
+ if config['server_type'] == 'automate'
34
+ server = 'automate'
35
+ msg = 'inspec compliance login_automate https://your_automate_server --user USER --ent ENT --dctoken DCTOKEN or --usertoken USERTOKEN'
36
+ else
37
+ server = 'compliance'
38
+ msg = "inspec compliance login https://your_compliance_server --user admin --insecure --token 'PASTE TOKEN HERE' "
39
+ end
40
+ fail Inspec::FetcherFailure, <<EOF
36
41
 
37
42
  Cannot fetch #{uri} because your #{server} token has not been
38
43
  configured.
@@ -41,14 +46,16 @@ Please login using
41
46
 
42
47
  #{msg}
43
48
  EOF
44
- end
49
+ end
45
50
 
46
- # verifies that the target e.g base/ssh exists
47
- profile = uri.host + uri.path
48
- if !Compliance::API.exist?(config, profile)
49
- fail Inspec::FetcherFailure, "The compliance profile #{profile} was not found on the configured compliance server"
51
+ # verifies that the target e.g base/ssh exists
52
+ profile = uri.host + uri.path
53
+ if !Compliance::API.exist?(config, profile)
54
+ fail Inspec::FetcherFailure, "The compliance profile #{profile} was not found on the configured compliance server"
55
+ end
56
+ profile_fetch_url = target_url(profile, config)
50
57
  end
51
- new(target_url(profile, config), config)
58
+ new(profile_fetch_url, config)
52
59
  rescue URI::Error => _e
53
60
  nil
54
61
  end
@@ -63,12 +70,14 @@ EOF
63
70
  target
64
71
  end
65
72
 
66
- #
67
73
  # We want to save compliance: in the lockfile rather than url: to
68
- # make sure we go back through the ComplianceAPI handling.
69
- #
74
+ # make sure we go back through the Compliance API handling.
70
75
  def resolved_source
71
- { compliance: supermarket_profile_name }
76
+ @resolved_source ||= {
77
+ compliance: compliance_profile_name,
78
+ url: @target,
79
+ sha256: sha256,
80
+ }
72
81
  end
73
82
 
74
83
  def to_s
@@ -77,7 +86,7 @@ EOF
77
86
 
78
87
  private
79
88
 
80
- def supermarket_profile_name
89
+ def compliance_profile_name
81
90
  m = %r{^#{@config['server']}/owners/(?<owner>[^/]+)/compliance/(?<id>[^/]+)/tar$}.match(@target)
82
91
  "#{m[:owner]}/#{m[:id]}"
83
92
  end
@@ -4,5 +4,5 @@
4
4
  # author: Christoph Hartmann
5
5
 
6
6
  module Inspec
7
- VERSION = '1.7.1'.freeze
7
+ VERSION = '1.7.2'.freeze
8
8
  end
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.7.1
4
+ version: 1.7.2
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-12-03 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: train