class Inspec::Resources::YumRepo

Public Class Methods

new(yum, reponame) click to toggle source
# File lib/inspec/resources/yum.rb, line 112
def initialize(yum, reponame)
  @yum = yum
  @reponame = reponame
end

Public Instance Methods

enabled?() click to toggle source
# File lib/inspec/resources/yum.rb, line 136
def enabled?
  return false unless exist?

  info["status"] == "enabled"
end
exist?() click to toggle source
# File lib/inspec/resources/yum.rb, line 132
def exist?
  !info.empty?
end
info() click to toggle source
# File lib/inspec/resources/yum.rb, line 124
def info
  return @cache if defined?(@cache)

  selection = @yum.repositories.select { |e| e["id"] == @reponame || shortname(e["id"]) == @reponame }
  @cache = selection.empty? ? {} : selection.first
  @cache
end
shortname(id) click to toggle source

extracts the shortname from a repo id e.g. extras/7/x86_64 -> extras

# File lib/inspec/resources/yum.rb, line 119
def shortname(id)
  val = %r{^\s*([^/]*?)/(.*?)\s*$}.match(id)
  val.nil? ? nil : val[1]
end
to_s() click to toggle source
# File lib/inspec/resources/yum.rb, line 158
def to_s
  "YumRepo #{@reponame}"
end