inspec 1.48.0 → 1.49.2
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 +4 -4
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +40 -16
- data/Rakefile +1 -1
- data/docs/resources/bond.md.erb +6 -1
- data/docs/resources/mysql_session.md.erb +24 -12
- data/docs/resources/passwd.md.erb +1 -1
- data/docs/resources/xml.md.erb +7 -2
- data/docs/shell.md +22 -0
- data/inspec.gemspec +1 -1
- data/lib/bundles/inspec-artifact/cli.rb +0 -2
- data/lib/bundles/inspec-compliance/api.rb +58 -3
- data/lib/bundles/inspec-compliance/cli.rb +1 -1
- data/lib/bundles/inspec-habitat/profile.rb +1 -1
- data/lib/fetchers/url.rb +1 -1
- data/lib/inspec/base_cli.rb +3 -1
- data/lib/inspec/cli.rb +11 -1
- data/lib/inspec/control_eval_context.rb +13 -2
- data/lib/inspec/dependencies/lockfile.rb +0 -2
- data/lib/inspec/dsl_shared.rb +8 -0
- data/lib/inspec/library_eval_context.rb +12 -1
- data/lib/inspec/metadata.rb +13 -44
- data/lib/inspec/objects/attribute.rb +1 -1
- data/lib/inspec/plugins/resource.rb +18 -2
- data/lib/inspec/profile.rb +17 -11
- data/lib/inspec/profile_context.rb +9 -3
- data/lib/inspec/profile_vendor.rb +1 -1
- data/lib/inspec/resource.rb +5 -0
- data/lib/inspec/rspec_json_formatter.rb +3 -3
- data/lib/inspec/rule.rb +1 -1
- data/lib/inspec/runner.rb +13 -5
- data/lib/inspec/schema.rb +1 -1
- data/lib/inspec/shell.rb +1 -1
- data/lib/inspec/version.rb +1 -1
- data/lib/resources/aide_conf.rb +0 -2
- data/lib/resources/apache_conf.rb +9 -2
- data/lib/resources/auditd.rb +0 -1
- data/lib/resources/auditd_rules.rb +0 -2
- data/lib/resources/bond.rb +4 -0
- data/lib/resources/crontab.rb +1 -1
- data/lib/resources/docker.rb +1 -1
- data/lib/resources/elasticsearch.rb +1 -1
- data/lib/resources/file.rb +2 -0
- data/lib/resources/groups.rb +29 -5
- data/lib/resources/grub_conf.rb +1 -1
- data/lib/resources/os.rb +8 -20
- data/lib/resources/package.rb +20 -21
- data/lib/resources/platform.rb +112 -0
- data/lib/resources/port.rb +1 -1
- data/lib/resources/processes.rb +1 -1
- data/lib/resources/registry_key.rb +1 -1
- data/lib/resources/service.rb +1 -1
- data/lib/resources/virtualization.rb +1 -1
- data/lib/resources/x509_certificate.rb +1 -1
- data/lib/resources/xml.rb +1 -0
- metadata +5 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff56bd489f8c7496d62120343dd41c16364bef74
|
4
|
+
data.tar.gz: c2fc41784be9b7695628bea807ba737ea1f0deb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc9b5edf8c20fa3b937a7215cb6aee10a3622de37d4bbfa9752666f92cbf355300b953840ee5a032be8ae3fd4a338cd0e6345be2156fab4b5d3dd008ef5193d0
|
7
|
+
data.tar.gz: 250b01f2dc31fd57a9321758e8ef6b4ffc47ddd025c1b0db157a842ff3ebe04467fe7e9e8f90ccf16afc3b7fbff767bab3a89d799dc4d5959000bfd76f48115e
|
data/.rubocop.yml
CHANGED
@@ -38,6 +38,8 @@ Metrics/AbcSize:
|
|
38
38
|
Max: 33
|
39
39
|
Metrics/BlockLength:
|
40
40
|
Max: 50
|
41
|
+
Metrics/ClassLength:
|
42
|
+
Enabled: false
|
41
43
|
Metrics/CyclomaticComplexity:
|
42
44
|
Max: 10
|
43
45
|
Metrics/PerceivedComplexity:
|
@@ -60,6 +62,8 @@ Style/Encoding:
|
|
60
62
|
Enabled: false
|
61
63
|
Style/FileName:
|
62
64
|
Enabled: false
|
65
|
+
Style/GuardClause:
|
66
|
+
Enabled: false
|
63
67
|
Style/IfUnlessModifier:
|
64
68
|
Enabled: false
|
65
69
|
Style/MethodMissing:
|
data/CHANGELOG.md
CHANGED
@@ -1,32 +1,57 @@
|
|
1
1
|
# Change Log
|
2
2
|
<!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
|
3
|
-
<!-- latest_release 1.
|
4
|
-
## [v1.
|
3
|
+
<!-- latest_release 1.49.2 -->
|
4
|
+
## [v1.49.2](https://github.com/chef/inspec/tree/v1.49.2) (2018-01-04)
|
5
5
|
|
6
|
-
####
|
7
|
-
-
|
6
|
+
#### Enhancements
|
7
|
+
- load local dependencies in inspec shell [#2438](https://github.com/chef/inspec/pull/2438) ([arlimus](https://github.com/arlimus))
|
8
8
|
<!-- latest_release -->
|
9
9
|
|
10
|
-
<!-- release_rollup since=1.
|
11
|
-
### Changes since 1.
|
10
|
+
<!-- release_rollup since=1.48.0 -->
|
11
|
+
### Changes since 1.48.0 release
|
12
12
|
|
13
13
|
#### Enhancements
|
14
|
-
-
|
15
|
-
-
|
14
|
+
- load local dependencies in inspec shell [#2438](https://github.com/chef/inspec/pull/2438) ([arlimus](https://github.com/arlimus)) <!-- 1.49.2 -->
|
15
|
+
- Deprecate and warn when comparing against OS name with capitals/spaces [#2397](https://github.com/chef/inspec/pull/2397) ([jquick](https://github.com/jquick)) <!-- 1.49.1 -->
|
16
|
+
- Add platform resource and platform supports [#2393](https://github.com/chef/inspec/pull/2393) ([jquick](https://github.com/jquick)) <!-- 1.48.12 -->
|
17
|
+
- file resource: adds `Synchronize` permission to windows ACL checks [#2399](https://github.com/chef/inspec/pull/2399) ([TheLonelyGhost](https://github.com/TheLonelyGhost)) <!-- 1.48.6 -->
|
18
|
+
- bond resource: Add bonding mode matcher [#2414](https://github.com/chef/inspec/pull/2414) ([ehanlon](https://github.com/ehanlon)) <!-- 1.48.8 -->
|
16
19
|
|
17
20
|
#### Bug Fixes
|
18
|
-
-
|
19
|
-
-
|
20
|
-
-
|
21
|
-
-
|
21
|
+
- Modify `inspec json` to use `check_mode` [#2435](https://github.com/chef/inspec/pull/2435) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 1.48.14 -->
|
22
|
+
- dependency chaining in libraries [#2428](https://github.com/chef/inspec/pull/2428) ([arlimus](https://github.com/arlimus)) <!-- 1.48.13 -->
|
23
|
+
- Update apache_conf regular expression to exclude whitespace. [#2416](https://github.com/chef/inspec/pull/2416) ([miah](https://github.com/miah)) <!-- 1.48.9 -->
|
24
|
+
- Add support for Darwin Directory Service groups [#2403](https://github.com/chef/inspec/pull/2403) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 1.48.4 -->
|
25
|
+
- Fix Docker build in the Expeditor pipeline [#2432](https://github.com/chef/inspec/pull/2432) ([adamleff](https://github.com/adamleff)) <!-- 1.48.11 -->
|
26
|
+
- Fix `x509_certificate` integration tests [#2431](https://github.com/chef/inspec/pull/2431) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 1.48.10 -->
|
27
|
+
- Fix OWCA detection for `compliance login` [#2401](https://github.com/chef/inspec/pull/2401) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 1.48.7 -->
|
28
|
+
- default attributes for nil and false [#2410](https://github.com/chef/inspec/pull/2410) ([arlimus](https://github.com/arlimus)) <!-- 1.48.5 -->
|
29
|
+
- package resource: Enhance resource error handling [#2388](https://github.com/chef/inspec/pull/2388) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 1.48.3 -->
|
22
30
|
|
23
31
|
#### Merged Pull Requests
|
24
|
-
-
|
25
|
-
-
|
26
|
-
- Update command resource to check for mock backend [#2353](https://github.com/chef/inspec/pull/2353) ([jquick](https://github.com/jquick)) <!-- 1.47.3 -->
|
32
|
+
- Bump minor version and cleanup changelog for release [#2440](https://github.com/chef/inspec/pull/2440) ([adamleff](https://github.com/adamleff)) <!-- 1.49.0 -->
|
33
|
+
- Split unit tests from functional [#2391](https://github.com/chef/inspec/pull/2391) ([adamleff](https://github.com/adamleff)) <!-- 1.48.2 -->
|
27
34
|
<!-- release_rollup -->
|
28
35
|
|
29
36
|
<!-- latest_stable_release -->
|
37
|
+
## [v1.48.0](https://github.com/chef/inspec/tree/v1.48.0) (2017-12-07)
|
38
|
+
|
39
|
+
#### Enhancements
|
40
|
+
- Update default cli options to be uniq per command type [#2378](https://github.com/chef/inspec/pull/2378) ([jquick](https://github.com/jquick))
|
41
|
+
- Allow crontab resource to read crontab at user specified paths. [#2328](https://github.com/chef/inspec/pull/2328) ([miah](https://github.com/miah))
|
42
|
+
|
43
|
+
#### Bug Fixes
|
44
|
+
- Update rspec cli control summary to not uniq fails/skips [#2362](https://github.com/chef/inspec/pull/2362) ([jquick](https://github.com/jquick))
|
45
|
+
- Resolve merge issue with json-config vs thor defaults [#2377](https://github.com/chef/inspec/pull/2377) ([jquick](https://github.com/jquick))
|
46
|
+
- Remove rainbow dependency, fix duplicate rake gem [#2374](https://github.com/chef/inspec/pull/2374) ([adamleff](https://github.com/adamleff))
|
47
|
+
- Allow `inspec check` to ignore `only_if` [#2250](https://github.com/chef/inspec/pull/2250) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
|
48
|
+
|
49
|
+
#### Merged Pull Requests
|
50
|
+
- Update command resource to check for mock backend [#2353](https://github.com/chef/inspec/pull/2353) ([jquick](https://github.com/jquick))
|
51
|
+
- Fix inspec appveyor test with the new local train transport [#2376](https://github.com/chef/inspec/pull/2376) ([jquick](https://github.com/jquick))
|
52
|
+
- Fix changelog categories, bump minor version for release [#2381](https://github.com/chef/inspec/pull/2381) ([adamleff](https://github.com/adamleff))
|
53
|
+
<!-- latest_stable_release -->
|
54
|
+
|
30
55
|
## [v1.47.0](https://github.com/chef/inspec/tree/v1.47.0) (2017-12-04)
|
31
56
|
|
32
57
|
#### New Features
|
@@ -40,7 +65,6 @@
|
|
40
65
|
|
41
66
|
#### Merged Pull Requests
|
42
67
|
- docker_image resource: properly handle registries in image strings [#2356](https://github.com/chef/inspec/pull/2356) ([adamleff](https://github.com/adamleff))
|
43
|
-
<!-- latest_stable_release -->
|
44
68
|
|
45
69
|
## [v1.46.2](https://github.com/chef/inspec/tree/v1.46.2) (2017-11-29)
|
46
70
|
|
data/Rakefile
CHANGED
@@ -68,7 +68,7 @@ namespace :test do
|
|
68
68
|
task :integration do
|
69
69
|
concurrency = ENV['CONCURRENCY'] || 1
|
70
70
|
os = ENV['OS'] || ''
|
71
|
-
sh(
|
71
|
+
sh("bundle exec kitchen test -c #{concurrency} #{os}")
|
72
72
|
end
|
73
73
|
|
74
74
|
task :ssh, [:target] do |_t, args|
|
data/docs/resources/bond.md.erb
CHANGED
@@ -37,7 +37,7 @@ The following examples show how to use this InSpec audit resource.
|
|
37
37
|
### Test parameters for bond0
|
38
38
|
|
39
39
|
describe bond('bond0') do
|
40
|
-
its('
|
40
|
+
its('mode') { should eq 'IEEE 802.3ad Dynamic link aggregation' }
|
41
41
|
its('Transmit Hash Policy') { should eq 'layer3+4 (1)' }
|
42
42
|
its('MII Status') { should eq 'up' }
|
43
43
|
its('MII Polling Interval (ms)') { should eq '100' }
|
@@ -75,6 +75,11 @@ The `interfaces` matcher tests if the named secondary interfaces are available:
|
|
75
75
|
|
76
76
|
its('interfaces') { should eq ['eth0', 'eth1', ...] }
|
77
77
|
|
78
|
+
### mode
|
79
|
+
The `mode` matcher tests the Bonding Mode:
|
80
|
+
|
81
|
+
its('mode') { should eq 'IEEE 802.3ad Dynamic link aggregation' }
|
82
|
+
|
78
83
|
### params
|
79
84
|
|
80
85
|
The `params` matcher tests arbitrary parameters for the bonded network interface:
|
@@ -13,14 +13,14 @@ Use the `mysql_session` InSpec audit resource to test SQL commands run against a
|
|
13
13
|
A `mysql_session` resource block declares the username and password to use for the session, and then the command to be run:
|
14
14
|
|
15
15
|
describe mysql_session('username', 'password').query('QUERY') do
|
16
|
-
its('
|
16
|
+
its('stdout') { should match(/expected-result/) }
|
17
17
|
end
|
18
18
|
|
19
19
|
where
|
20
20
|
|
21
|
-
* `mysql_session` declares a username and password with permission to run the query
|
21
|
+
* `mysql_session` declares a username and password, connecting locally, with permission to run the query
|
22
22
|
* `query('QUERY')` contains the query to be run
|
23
|
-
* `its('
|
23
|
+
* `its('stdout') { should eq(/expected-result/) }` compares the results of the query against the expected result in the test
|
24
24
|
|
25
25
|
<br>
|
26
26
|
|
@@ -38,24 +38,36 @@ The following examples show how to use this InSpec audit resource.
|
|
38
38
|
|
39
39
|
### Alternate Connection: Different Host
|
40
40
|
|
41
|
-
|
41
|
+
sql = mysql_session('my_user','password','db.example.com')
|
42
42
|
|
43
43
|
### Alternate Connection: Different Port
|
44
44
|
|
45
|
-
|
45
|
+
sql = mysql_session('my_user','password','localhost',3307)
|
46
46
|
|
47
47
|
### Alternate Connection: Using a socket
|
48
48
|
|
49
|
-
|
49
|
+
sql = mysql_session('my_user','password', nil, nil, '/var/lib/mysql-default/mysqld.sock')
|
50
50
|
|
51
|
-
|
51
|
+
### Test for a successful query
|
52
52
|
|
53
|
-
|
53
|
+
describe mysql_session('my_user','password').query('show tables in existing_database;') do
|
54
|
+
its('exit_status') { should eq(0) }
|
55
|
+
end
|
56
|
+
|
57
|
+
### Test for a failing query
|
58
|
+
|
59
|
+
describe mysql_session('my_user','password').query('show tables in non_existent_database;') do
|
60
|
+
its('exit_status') { should_not eq(0) }
|
61
|
+
end
|
54
62
|
|
55
|
-
|
63
|
+
### Test for specific error message
|
56
64
|
|
57
|
-
|
65
|
+
describe mysql_session('my_user','password').query('show tables in non_existent_database;') do
|
66
|
+
its('stderr') { should match(/Unknown database/) }
|
67
|
+
end
|
58
68
|
|
59
|
-
|
69
|
+
<br>
|
70
|
+
|
71
|
+
## Matchers
|
60
72
|
|
61
|
-
|
73
|
+
This InSpec audit resource builds a [command](https://www.inspec.io/docs/reference/resources/command) object and returns the the result object. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
@@ -59,7 +59,7 @@ The following examples show how to use this InSpec audit resource.
|
|
59
59
|
its('count') { should eq 1 }
|
60
60
|
end
|
61
61
|
|
62
|
-
describe passwd.
|
62
|
+
describe passwd.where { user == 'www-data' } do
|
63
63
|
its('uids') { should cmp 33 }
|
64
64
|
its('count') { should eq 1 }
|
65
65
|
end
|
data/docs/resources/xml.md.erb
CHANGED
@@ -28,7 +28,7 @@ This file can be queried using:
|
|
28
28
|
describe xml('/path/to/name.xml') do
|
29
29
|
its('root/name') { should eq ['hello'] }
|
30
30
|
its('root/meta/creator') { should eq ['John Doe'] }
|
31
|
-
its('root/array[2]/element
|
31
|
+
its('root/array[2]/element') { should eq ['two'] }
|
32
32
|
end
|
33
33
|
|
34
34
|
where
|
@@ -38,6 +38,10 @@ where
|
|
38
38
|
|
39
39
|
<br>
|
40
40
|
|
41
|
+
In the event the path contains an element which contains periods, the alternate syntax can be used:
|
42
|
+
|
43
|
+
its(['root/name.with.a.period']) { should cmp 'so_many_dots' }
|
44
|
+
|
41
45
|
## Examples
|
42
46
|
|
43
47
|
The following examples show how to use this InSpec audit resource.
|
@@ -45,7 +49,8 @@ The following examples show how to use this InSpec audit resource.
|
|
45
49
|
### Test an AppPool's presence in an applicationHost.config file
|
46
50
|
|
47
51
|
describe xml('applicationHost.config') do
|
48
|
-
|
52
|
+
# using the alternate syntax as described above because of the . in the key name
|
53
|
+
its(['configuration/system.applicationHost/applicationPools/add@name']) { should contain('my_pool') }
|
49
54
|
end
|
50
55
|
|
51
56
|
<br>
|
data/docs/shell.md
CHANGED
@@ -40,6 +40,28 @@ $ inspec shell -t winrm://UserName:Password@windowsmachine:1234 # Login to wind
|
|
40
40
|
$ inspec shell -t docker://container_id # Login to a docker container.
|
41
41
|
```
|
42
42
|
|
43
|
+
## Resource packs
|
44
|
+
|
45
|
+
The InSpec shell may use additional keywords provided in resource packs.
|
46
|
+
A resource pack is a profile that defines new language terms that can
|
47
|
+
be used in InSpec. For example, the profile in `examples/profile` in
|
48
|
+
the InSpec git repo defines a `gordon_config` resource. To use these
|
49
|
+
resources with the InSpec shell, you will need to download and specify
|
50
|
+
them as a dependency.
|
51
|
+
|
52
|
+
To use the `gordon_config` resource that is provided in the `examples/profile`
|
53
|
+
in the InSpec repo you can run the following:
|
54
|
+
|
55
|
+
```bash
|
56
|
+
inspec shell --depends examples/profile
|
57
|
+
```
|
58
|
+
|
59
|
+
Once inside the shell your resource will be available:
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
inspec> gordon_config
|
63
|
+
```
|
64
|
+
|
43
65
|
## Using Ruby in InSpec shell
|
44
66
|
|
45
67
|
Since InSpec shell is pry based, you may treat the shell as an
|
data/inspec.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
|
27
27
|
spec.required_ruby_version = '>= 2.3'
|
28
28
|
|
29
|
-
spec.add_dependency 'train', '~> 0.
|
29
|
+
spec.add_dependency 'train', '~> 0.32'
|
30
30
|
spec.add_dependency 'thor', '~> 0.19'
|
31
31
|
spec.add_dependency 'json', '>= 1.8', '< 3.0'
|
32
32
|
spec.add_dependency 'method_source', '~> 0.8'
|
@@ -12,7 +12,7 @@ module Compliance
|
|
12
12
|
|
13
13
|
# API Implementation does not hold any state by itself,
|
14
14
|
# everything will be stored in local Configuration store
|
15
|
-
class API
|
15
|
+
class API
|
16
16
|
extend Compliance::API::Login
|
17
17
|
|
18
18
|
# return all compliance profiles available for the user
|
@@ -251,11 +251,66 @@ module Compliance
|
|
251
251
|
end
|
252
252
|
|
253
253
|
def self.determine_server_type(url, insecure)
|
254
|
-
if
|
254
|
+
if target_is_automate_server?(url, insecure)
|
255
255
|
:automate
|
256
|
-
elsif
|
256
|
+
elsif target_is_compliance_server?(url, insecure)
|
257
257
|
:compliance
|
258
|
+
else
|
259
|
+
Inspec::Log.debug('Could not determine server type using known endpoints')
|
260
|
+
nil
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
def self.target_is_automate_server?(url, insecure)
|
265
|
+
automate_endpoint = '/compliance/version'
|
266
|
+
response = Compliance::HTTP.get(url + automate_endpoint, nil, insecure)
|
267
|
+
case response.code
|
268
|
+
when '401'
|
269
|
+
Inspec::Log.debug(
|
270
|
+
"Received 401 from #{url}#{automate_endpoint} - " \
|
271
|
+
'assuming target is a Chef Automate instance',
|
272
|
+
)
|
273
|
+
true
|
274
|
+
when '200'
|
275
|
+
# Chef Automate currently returns 401 for `/compliance/version` but some
|
276
|
+
# versions of OpsWorks Chef Automate return 200 and a Chef Manage page
|
277
|
+
# when unauthenticated requests are received.
|
278
|
+
if response.body.include?('Are You Looking For the Chef Server?')
|
279
|
+
Inspec::Log.debug(
|
280
|
+
"Received 200 from #{url}#{automate_endpoint} - " \
|
281
|
+
'assuming target is an OpsWorks Chef Automate instance',
|
282
|
+
)
|
283
|
+
true
|
284
|
+
else
|
285
|
+
Inspec::Log.debug(
|
286
|
+
"Received 200 from #{url}#{automate_endpoint} " \
|
287
|
+
'but did not receive the Chef Manage page - ' \
|
288
|
+
'assuming target is not a Chef Automate instance',
|
289
|
+
)
|
290
|
+
false
|
291
|
+
end
|
292
|
+
else
|
293
|
+
Inspec::Log.debug(
|
294
|
+
"Received unexpected status code #{response.code} " \
|
295
|
+
"from #{url}#{automate_endpoint} - " \
|
296
|
+
'assuming target is not a Chef Automate instance',
|
297
|
+
)
|
298
|
+
false
|
258
299
|
end
|
259
300
|
end
|
301
|
+
|
302
|
+
def self.target_is_compliance_server?(url, insecure)
|
303
|
+
# All versions of Chef Compliance return 200 for `/api/version`
|
304
|
+
compliance_endpoint = '/api/version'
|
305
|
+
|
306
|
+
response = Compliance::HTTP.get(url + compliance_endpoint, nil, insecure)
|
307
|
+
return false unless response.code == '200'
|
308
|
+
|
309
|
+
Inspec::Log.debug(
|
310
|
+
"Received 200 from #{url}#{compliance_endpoint} - " \
|
311
|
+
'assuming target is a Compliance server',
|
312
|
+
)
|
313
|
+
true
|
314
|
+
end
|
260
315
|
end
|
261
316
|
end
|
@@ -6,7 +6,7 @@ require 'thor'
|
|
6
6
|
require 'erb'
|
7
7
|
|
8
8
|
module Compliance
|
9
|
-
class ComplianceCLI < Inspec::BaseCLI
|
9
|
+
class ComplianceCLI < Inspec::BaseCLI
|
10
10
|
namespace 'compliance'
|
11
11
|
|
12
12
|
# TODO: find another solution, once https://github.com/erikhuda/thor/issues/261 is fixed
|
data/lib/fetchers/url.rb
CHANGED
data/lib/inspec/base_cli.rb
CHANGED
@@ -7,7 +7,7 @@ require 'inspec/log'
|
|
7
7
|
require 'inspec/profile_vendor'
|
8
8
|
|
9
9
|
module Inspec
|
10
|
-
class BaseCLI < Thor
|
10
|
+
class BaseCLI < Thor
|
11
11
|
def self.target_options
|
12
12
|
option :target, aliases: :t, type: :string,
|
13
13
|
desc: 'Simple targeting option using URIs, e.g. ssh://user:pass@host:port'
|
@@ -64,6 +64,8 @@ module Inspec
|
|
64
64
|
option :attrs, type: :array,
|
65
65
|
desc: 'Load attributes file (experimental)'
|
66
66
|
option :cache, type: :string,
|
67
|
+
desc: '[DEPRECATED] Please use --vendor-cache - this will be removed in InSpec 2.0'
|
68
|
+
option :vendor_cache, type: :string,
|
67
69
|
desc: 'Use the given path for caching dependencies. (default: ~/.inspec/cache)'
|
68
70
|
option :create_lockfile, type: :boolean,
|
69
71
|
desc: 'Write out a lockfile based on this execution (unless one already exists)'
|
data/lib/inspec/cli.rb
CHANGED
@@ -15,7 +15,7 @@ require 'inspec/runner_mock'
|
|
15
15
|
require 'inspec/env_printer'
|
16
16
|
require 'inspec/schema'
|
17
17
|
|
18
|
-
class Inspec::InspecCLI < Inspec::BaseCLI
|
18
|
+
class Inspec::InspecCLI < Inspec::BaseCLI
|
19
19
|
class_option :log_level, aliases: :l, type: :string,
|
20
20
|
desc: 'Set the log level: info (default), debug, warn, error'
|
21
21
|
|
@@ -36,6 +36,7 @@ class Inspec::InspecCLI < Inspec::BaseCLI # rubocop:disable Metrics/ClassLength
|
|
36
36
|
o = opts.dup
|
37
37
|
o[:ignore_supports] = true
|
38
38
|
o[:backend] = Inspec::Backend.create(target: 'mock://')
|
39
|
+
o[:check_mode] = true
|
39
40
|
|
40
41
|
profile = Inspec::Profile.for_target(target, o)
|
41
42
|
dst = o[:output].to_s
|
@@ -155,6 +156,13 @@ class Inspec::InspecCLI < Inspec::BaseCLI # rubocop:disable Metrics/ClassLength
|
|
155
156
|
o = opts(:exec).dup
|
156
157
|
configure_logger(o)
|
157
158
|
|
159
|
+
# check for deprecated --cache
|
160
|
+
# TODO: REMOVE for inspec 2.0
|
161
|
+
if o.key?('cache')
|
162
|
+
o[:vendor_cache] = o[:cache]
|
163
|
+
o[:logger].warn '[DEPRECATED] The use of `--cache` is being deprecated in InSpec 2.0. Please use `--vendor-cache` instead.'
|
164
|
+
end
|
165
|
+
|
158
166
|
# run tests
|
159
167
|
run_tests(targets, o)
|
160
168
|
rescue StandardError => e
|
@@ -187,6 +195,8 @@ class Inspec::InspecCLI < Inspec::BaseCLI # rubocop:disable Metrics/ClassLength
|
|
187
195
|
desc: 'A single command string to run instead of launching the shell'
|
188
196
|
option :format, type: :string, default: nil, hide: true,
|
189
197
|
desc: 'Which formatter to use: cli, documentation, html, json, json-min, junit, progress'
|
198
|
+
option :depends, type: :array, default: [],
|
199
|
+
desc: 'A space-delimited list of local folders containing profiles whose libraries and resources will be loaded into the new shell'
|
190
200
|
def shell_func
|
191
201
|
diagnose
|
192
202
|
o = opts.dup
|