class Inspec::Resources::Rpms

RedHat family

def build_package_list

def build_package_list
  # use two spaces as delimiter in case any of the fields has a space in it
  command = "rpm -qa --queryformat '%{NAME}  %{VERSION}-%{RELEASE}  %{ARCH}\\n'" # rubocop:disable Style/FormatStringToken
  cmd = inspec.command(command)
  all = cmd.stdout.split("\n")
  return [] if all.nil?
  all.map do |m|
    a = m.split('  ')
    a.unshift('installed')
    PackageStruct.new(*a)
  end
end