Class: Inspec::Resources::FreebsdPkg
- Inherits:
-
PkgManagement
- Object
- PkgManagement
- Inspec::Resources::FreebsdPkg
- Defined in:
- lib/inspec/resources/package.rb
Instance Attribute Summary
Attributes inherited from PkgManagement
Instance Method Summary collapse
Methods inherited from PkgManagement
#initialize, #missing_requirements
Constructor Details
This class inherits a constructor from Inspec::Resources::PkgManagement
Instance Method Details
#info(package_name) ⇒ Object
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
# File 'lib/inspec/resources/package.rb', line 345 def info(package_name) cmd = inspec.command("pkg info #{package_name}") return {} if cmd.exit_status.to_i != 0 params = SimpleConfig.new( cmd.stdout.chomp, assignment_regex: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/, multiple_values: false ).params { name: params["Name"], installed: true, version: params["Version"], type: "pkg", only_version_no: params["Version"], } end |
#latest_version(package_name) ⇒ Object
364 365 366 367 |
# File 'lib/inspec/resources/package.rb', line 364 def latest_version(package_name) cmd_string = "pkg version -v | grep #{package_name}" fetch_latest_version(cmd_string) end |