Class: Inspec::Resources::Deb
- Inherits:
-
PkgManagement
- Object
- PkgManagement
- Inspec::Resources::Deb
- Defined in:
- lib/resources/package.rb
Overview
Debian / Ubuntu
Instance Attribute Summary
Attributes inherited from PkgManagement
Instance Method Summary collapse
Methods inherited from PkgManagement
Constructor Details
This class inherits a constructor from Inspec::Resources::PkgManagement
Instance Method Details
#info(package_name) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/resources/package.rb', line 85 def info(package_name) cmd = inspec.command("dpkg -s #{package_name}") return nil if cmd.exit_status.to_i != 0 params = SimpleConfig.new( cmd.stdout.chomp, assignment_re: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/, multiple_values: false, ).params # If the package is removed and not purged, Status is "deinstall ok config-files" with exit_status 0 # If the package is purged cmd fails with non-zero exit status { name: params['Package'], installed: params['Status'].split(' ').first == 'install', version: params['Version'], type: 'deb', } end |