inspec 4.12.0 → 4.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/etc/plugin_filters.json +0 -4
- data/lib/fetchers/git.rb +2 -0
- data/lib/inspec/base_cli.rb +2 -0
- data/lib/inspec/cli.rb +2 -2
- data/lib/inspec/config.rb +49 -2
- data/lib/inspec/input_registry.rb +30 -0
- data/lib/inspec/metadata.rb +4 -0
- data/lib/inspec/plugin/v1/plugin_types/resource.rb +5 -11
- data/lib/inspec/plugin/v2/filter.rb +33 -0
- data/lib/inspec/plugin/v2/installer.rb +10 -7
- data/lib/inspec/plugin/v2/loader.rb +64 -20
- data/lib/inspec/profile.rb +12 -2
- data/lib/inspec/resources.rb +1 -0
- data/lib/inspec/resources/postfix_conf.rb +31 -0
- data/lib/inspec/version.rb +1 -1
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb +88 -53
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb +125 -97
- data/lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb +8 -6
- data/lib/source_readers/inspec.rb +14 -12
- metadata +3 -2
@@ -13,13 +13,15 @@ class PluginManagerCliOptions < Minitest::Test
|
|
13
13
|
|
14
14
|
def test_list_args
|
15
15
|
arg_config = cli_class.all_commands["list"].options
|
16
|
-
assert_equal
|
16
|
+
assert_equal 4, arg_config.count, "The list command should have 4 options"
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
{ u: :user, a: :all, c: :core, s: :system }.each do |abbrev, option|
|
19
|
+
assert_includes arg_config.keys, option, "The list command should have an --#{option} option"
|
20
|
+
assert_equal :boolean, arg_config[option].type, "The --#{option} option should be boolean"
|
21
|
+
assert_equal abbrev, arg_config[option].aliases.first, "The --#{option} option should be aliased as -#{abbrev}"
|
22
|
+
refute_nil arg_config[option].description, "The --#{option} option should have a description"
|
23
|
+
refute arg_config[option].required, "The --#{option} option should not be required"
|
24
|
+
end
|
23
25
|
|
24
26
|
assert_equal 0, cli_class.instance_method(:list).arity, "The list command should take no arguments"
|
25
27
|
end
|
@@ -40,25 +40,27 @@ module SourceReaders
|
|
40
40
|
raise "Unable to parse #{metadata_source}: #{e.class} -- #{e.message}"
|
41
41
|
end
|
42
42
|
|
43
|
+
def find_all(regexp)
|
44
|
+
@target.files.grep(regexp)
|
45
|
+
end
|
46
|
+
|
47
|
+
def load_all(regexp)
|
48
|
+
find_all(regexp)
|
49
|
+
.map { |path| file = @target.read(path); [path, file] if file }
|
50
|
+
.compact
|
51
|
+
.to_h
|
52
|
+
end
|
53
|
+
|
43
54
|
def load_tests
|
44
|
-
|
45
|
-
path.start_with?("controls") && path.end_with?(".rb")
|
46
|
-
end
|
47
|
-
Hash[tests.map { |x| [x, @target.read(x)] }.delete_if { |_file, contents| contents.nil? }]
|
55
|
+
load_all(%r{^controls/.*\.rb$})
|
48
56
|
end
|
49
57
|
|
50
58
|
def load_libs
|
51
|
-
|
52
|
-
path.start_with?("libraries") && path.end_with?(".rb")
|
53
|
-
end
|
54
|
-
Hash[tests.map { |x| [x, @target.read(x)] }.delete_if { |_file, contents| contents.nil? }]
|
59
|
+
load_all(%r{^libraries/.*\.rb$})
|
55
60
|
end
|
56
61
|
|
57
62
|
def load_data_files
|
58
|
-
files
|
59
|
-
path.start_with?("files" + File::SEPARATOR)
|
60
|
-
end
|
61
|
-
Hash[files.map { |x| [x, @target.read(x)] }.delete_if { |_file, contents| contents.nil? }]
|
63
|
+
load_all(%r{^files/})
|
62
64
|
end
|
63
65
|
end
|
64
66
|
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: 4.
|
4
|
+
version: 4.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef InSpec Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: train
|
@@ -589,6 +589,7 @@ files:
|
|
589
589
|
- lib/inspec/resources/pip.rb
|
590
590
|
- lib/inspec/resources/platform.rb
|
591
591
|
- lib/inspec/resources/port.rb
|
592
|
+
- lib/inspec/resources/postfix_conf.rb
|
592
593
|
- lib/inspec/resources/postgres.rb
|
593
594
|
- lib/inspec/resources/postgres_conf.rb
|
594
595
|
- lib/inspec/resources/postgres_hba_conf.rb
|