Class: Inspec::Resources::AlpinePkgs

Inherits:
PkgsManagement show all
Defined in:
lib/inspec/resources/packages.rb

Overview

RedHat family

Instance Attribute Summary

Attributes inherited from PkgsManagement

#inspec

Instance Method Summary collapse

Methods inherited from PkgsManagement

#initialize

Constructor Details

This class inherits a constructor from Inspec::Resources::PkgsManagement

Instance Method Details

#build_package_listObject



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/inspec/resources/packages.rb', line 116

def build_package_list
  command = "apk list --no-network --installed"
  cmd = inspec.command(command)
  all = cmd.stdout.split("\n")
  return [] if all.nil? || cmd.exit_status.to_i != 0

  all.map do |m|
    next if m =~ /^WARNING/i

    a = m.split(" ")
    version = a[0].split("-")[-2]
    name = a[2].gsub(/[{}^]*/, "")
    PackageStruct.new("installed", name, version, a[1])
  end
end