inspec 2.2.35 → 2.2.41

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.
@@ -19,8 +19,10 @@ module Inspec::Resources
19
19
  its('version') { should eq 1.9.5 }
20
20
  end
21
21
  "
22
-
23
- def initialize(package_name, opts = {}) # rubocop:disable Metrics/AbcSize
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.35
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-09 00:00:00.000000000 Z
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