inspec 0.33.0 → 0.33.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -2
- data/lib/inspec/profile.rb +3 -3
- data/lib/inspec/profile_context.rb +3 -2
- data/lib/inspec/runner.rb +5 -2
- data/lib/inspec/version.rb +1 -1
- data/lib/source_readers/inspec.rb +0 -23
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9b2ba9958d13778fe972ca9961229db0c99ed68
|
4
|
+
data.tar.gz: e84133108b846956beedaff95f964227395e3889
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11ac1cd70c2a131ae8f1642e562429c488e844351482e484820b033802d5250036e6fb3a6492bcbbddc0916f6a080773e9bdaaad486b3af851dbb050b578716a
|
7
|
+
data.tar.gz: a54263c5bc62a0f17e234ac3c4ebb8505245407620917d2c4463c8828da7169f3ea2dddc9d6d8757d11fbe0281f9928e81473f6d657cea75c7e89b376b769cc6
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,21 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [0.33.
|
4
|
-
[Full Changelog](https://github.com/chef/inspec/compare/v0.
|
3
|
+
## [0.33.1](https://github.com/chef/inspec/tree/0.33.1) (2016-09-07)
|
4
|
+
[Full Changelog](https://github.com/chef/inspec/compare/v0.33.0...0.33.1)
|
5
|
+
|
6
|
+
**Closed issues:**
|
7
|
+
|
8
|
+
- Research: determine mechanism for recording + playing back inspec [\#955](https://github.com/chef/inspec/issues/955)
|
9
|
+
- Create content for interactive inspec online demo [\#954](https://github.com/chef/inspec/issues/954)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Pass attributes from command line into profile context [\#1026](https://github.com/chef/inspec/pull/1026) ([stevendanna](https://github.com/stevendanna))
|
14
|
+
- Remove SourceReader::Inspec\#prepare\_load\_path [\#1023](https://github.com/chef/inspec/pull/1023) ([stevendanna](https://github.com/stevendanna))
|
15
|
+
- add demo yml contents [\#1022](https://github.com/chef/inspec/pull/1022) ([arlimus](https://github.com/arlimus))
|
16
|
+
|
17
|
+
## [v0.33.0](https://github.com/chef/inspec/tree/v0.33.0) (2016-09-05)
|
18
|
+
[Full Changelog](https://github.com/chef/inspec/compare/v0.32.0...v0.33.0)
|
5
19
|
|
6
20
|
**Implemented enhancements:**
|
7
21
|
|
data/lib/inspec/profile.rb
CHANGED
@@ -45,8 +45,8 @@ module Inspec
|
|
45
45
|
def_delegator :@source_reader, :metadata
|
46
46
|
|
47
47
|
# rubocop:disable Metrics/AbcSize
|
48
|
-
def initialize(source_reader, options =
|
49
|
-
@options = options
|
48
|
+
def initialize(source_reader, options = {})
|
49
|
+
@options = options
|
50
50
|
@target = @options.delete(:target)
|
51
51
|
@logger = @options[:logger] || Logger.new(nil)
|
52
52
|
@source_reader = source_reader
|
@@ -57,7 +57,7 @@ module Inspec
|
|
57
57
|
@profile_id = @options[:id]
|
58
58
|
@backend = @options[:backend] || Inspec::Backend.create(options)
|
59
59
|
Metadata.finalize(@source_reader.metadata, @profile_id)
|
60
|
-
@runner_context = @options[:profile_context] || Inspec::ProfileContext.for_profile(self, @backend)
|
60
|
+
@runner_context = @options[:profile_context] || Inspec::ProfileContext.for_profile(self, @backend, @options[:attributes])
|
61
61
|
end
|
62
62
|
|
63
63
|
def name
|
@@ -12,8 +12,9 @@ require 'inspec/objects/attribute'
|
|
12
12
|
|
13
13
|
module Inspec
|
14
14
|
class ProfileContext # rubocop:disable Metrics/ClassLength
|
15
|
-
def self.for_profile(profile, backend)
|
16
|
-
new(profile.name, backend, { 'profile' => profile
|
15
|
+
def self.for_profile(profile, backend, attributes)
|
16
|
+
new(profile.name, backend, { 'profile' => profile,
|
17
|
+
'attributes' => attributes })
|
17
18
|
end
|
18
19
|
|
19
20
|
attr_reader :attributes, :rules, :profile_id, :resource_registry
|
data/lib/inspec/runner.rb
CHANGED
@@ -126,13 +126,16 @@ module Inspec
|
|
126
126
|
# @eturns [Inspec::ProfileContext]
|
127
127
|
#
|
128
128
|
def add_target(target, _opts = [])
|
129
|
-
profile = Inspec::Profile.for_target(target,
|
129
|
+
profile = Inspec::Profile.for_target(target,
|
130
|
+
backend: @backend,
|
131
|
+
controls: @controls,
|
132
|
+
attributes: @conf[:attributes])
|
130
133
|
fail "Could not resolve #{target} to valid input." if profile.nil?
|
131
134
|
@target_profiles << profile if supports_profile?(profile)
|
132
135
|
end
|
133
136
|
|
134
137
|
#
|
135
|
-
# This is used by inspec-shell and inspec-detect.
|
138
|
+
# This is used by inspec-shell and inspec-detect. This should
|
136
139
|
# probably be cleaned up a bit.
|
137
140
|
#
|
138
141
|
# @params [Hash] Options
|
data/lib/inspec/version.rb
CHANGED
@@ -34,7 +34,6 @@ module SourceReaders
|
|
34
34
|
|
35
35
|
@tests = load_tests
|
36
36
|
@libraries = load_libs
|
37
|
-
prepare_load_paths
|
38
37
|
end
|
39
38
|
|
40
39
|
private
|
@@ -52,27 +51,5 @@ module SourceReaders
|
|
52
51
|
end
|
53
52
|
Hash[tests.map { |x| [x, @target.read(x)] }]
|
54
53
|
end
|
55
|
-
|
56
|
-
# Ensure each test directory exists on the $LOAD_PATH. This
|
57
|
-
# will ensure traditional RSpec-isms like `require 'spec_helper'`
|
58
|
-
# continue to work. The method outlined here is only meant to be temporary!
|
59
|
-
def prepare_load_paths
|
60
|
-
t = @target
|
61
|
-
t = @target.parent unless @target.parent.nil?
|
62
|
-
unless t.is_a?(Fetchers::Local)
|
63
|
-
return # no need to mess with load-paths if this is not on disk
|
64
|
-
end
|
65
|
-
|
66
|
-
rel_dirs = (@libraries.keys + @tests.keys)
|
67
|
-
.map { |x| File.dirname(x) }.uniq
|
68
|
-
|
69
|
-
abs_dirs = rel_dirs.map { |x| @target.abs_path(x) }
|
70
|
-
.find_all { |x| File.directory?(x) }
|
71
|
-
.map { |x| File.expand_path(x) }
|
72
|
-
|
73
|
-
abs_dirs.each do |dir|
|
74
|
-
$LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
|
75
|
-
end
|
76
|
-
end
|
77
54
|
end
|
78
55
|
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: 0.33.
|
4
|
+
version: 0.33.1
|
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-09-
|
11
|
+
date: 2016-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: train
|