inspec 2.2.35 → 2.2.41
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -10
- data/README.md +7 -5
- data/bin/inspec +0 -0
- data/docs/dsl_inspec.md +35 -39
- data/docs/glossary.md +15 -15
- data/docs/habitat.md +10 -9
- data/docs/inspec_and_friends.md +4 -4
- data/docs/matchers.md +1 -9
- data/docs/plugin_kitchen_inspec.md +34 -24
- data/docs/profiles.md +217 -156
- data/docs/reporters.md +13 -4
- data/docs/resources/command.md.erb +28 -0
- data/docs/resources/registry_key.md.erb +5 -2
- data/docs/resources/xinetd_conf.md.erb +1 -1
- data/docs/ruby_usage.md +4 -3
- data/lib/bundles/inspec-init.rb +4 -0
- data/lib/bundles/inspec-init/cli.rb +9 -72
- data/lib/bundles/inspec-init/renderer.rb +79 -0
- data/lib/inspec/base_cli.rb +25 -12
- data/lib/inspec/objects/describe.rb +8 -1
- data/lib/inspec/plugins/resource.rb +2 -2
- data/lib/inspec/version.rb +1 -1
- data/lib/resources/command.rb +17 -2
- data/lib/resources/package.rb +26 -2
- metadata +3 -2
data/lib/resources/package.rb
CHANGED
@@ -19,8 +19,10 @@ module Inspec::Resources
|
|
19
19
|
its('version') { should eq 1.9.5 }
|
20
20
|
end
|
21
21
|
"
|
22
|
-
|
23
|
-
|
22
|
+
# rubocop:disable Metrics/AbcSize
|
23
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
24
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
25
|
+
def initialize(package_name, opts = {})
|
24
26
|
@package_name = package_name
|
25
27
|
@name = @package_name
|
26
28
|
@cache = nil
|
@@ -44,12 +46,17 @@ module Inspec::Resources
|
|
44
46
|
@pkgman = SolarisPkg.new(inspec)
|
45
47
|
elsif ['hpux'].include?(os[:family])
|
46
48
|
@pkgman = HpuxPkg.new(inspec)
|
49
|
+
elsif ['alpine'].include?(os[:name])
|
50
|
+
@pkgman = AlpinePkg.new(inspec)
|
47
51
|
else
|
48
52
|
raise Inspec::Exceptions::ResourceSkipped, 'The `package` resource is not supported on your OS yet.'
|
49
53
|
end
|
50
54
|
|
51
55
|
evaluate_missing_requirements
|
52
56
|
end
|
57
|
+
# rubocop:enable Metrics/AbcSize
|
58
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
59
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
53
60
|
|
54
61
|
# returns true if the package is installed
|
55
62
|
def installed?(_provider = nil, _version = nil)
|
@@ -252,6 +259,23 @@ module Inspec::Resources
|
|
252
259
|
end
|
253
260
|
end
|
254
261
|
|
262
|
+
class AlpinePkg < PkgManagement
|
263
|
+
def info(package_name)
|
264
|
+
cmd = inspec.command("apk info -vv --no-network | grep #{package_name}")
|
265
|
+
return {} if cmd.exit_status.to_i != 0
|
266
|
+
|
267
|
+
pkg_info = cmd.stdout.split("\n").reject! { |e| e =~ /^WARNING/i }
|
268
|
+
pkg = pkg_info[0].split(' - ')[0]
|
269
|
+
|
270
|
+
{
|
271
|
+
name: pkg.partition('-')[0],
|
272
|
+
installed: true,
|
273
|
+
version: pkg.partition('-')[2],
|
274
|
+
type: 'pkg',
|
275
|
+
}
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
255
279
|
# Determines the installed packages on Windows using the Windows package registry entries.
|
256
280
|
# @see: http://blogs.technet.com/b/heyscriptingguy/archive/2013/11/15/use-powershell-to-find-installed-software.aspx
|
257
281
|
class WindowsPkg < PkgManagement
|
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: 2.2.
|
4
|
+
version: 2.2.41
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominik Richter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: train
|
@@ -560,6 +560,7 @@ files:
|
|
560
560
|
- lib/bundles/inspec-init.rb
|
561
561
|
- lib/bundles/inspec-init/README.md
|
562
562
|
- lib/bundles/inspec-init/cli.rb
|
563
|
+
- lib/bundles/inspec-init/renderer.rb
|
563
564
|
- lib/bundles/inspec-init/templates/profile/README.md
|
564
565
|
- lib/bundles/inspec-init/templates/profile/controls/example.rb
|
565
566
|
- lib/bundles/inspec-init/templates/profile/inspec.yml
|