Sha256: 440961de2097578343e384df4acd0ad105ed9256b48c0bb190a7158231ac9a44

Contents?: true

Size: 1.23 KB

Versions: 515

Compression:

Stored size: 1.23 KB

Contents

Puppet::Type.type(:package).provide :rug, :parent => :rpm do
  desc "Support for suse `rug` package manager."

  has_feature :versionable

  commands :rug => "/usr/bin/rug"
  commands :rpm => "rpm"
  confine    :operatingsystem => [:suse, :sles]

  # Install a package using 'rug'.
  def install
    should = @resource.should(:ensure)
    self.debug "Ensuring => #{should}"
    wanted = @resource[:name]

    # XXX: We don't actually deal with epochs here.
    case should
    when true, false, Symbol
      # pass
    else
      # Add the package version
      wanted += "-#{should}"
    end
    rug "--quiet", :install, "-y", wanted

    unless self.query
      raise Puppet::ExecutionFailure.new(
        _("Could not find package %{name}") % { name: self.name }
      )
    end
  end

  # What's the latest package version available?
  def latest
    #rug can only get a list of *all* available packages?
    output = rug "list-updates"

    if output =~ /#{Regexp.escape @resource[:name]}\s*\|\s*([^\s\|]+)/
      return $1
    else
      # rug didn't find updates, pretend the current
      # version is the latest
      return @property_hash[:ensure]
    end
  end

  def update
    # rug install can be used for update, too
    self.install
  end
end

Version data entries

515 entries across 515 versions & 2 rubygems

Version Path
puppet-7.34.0 lib/puppet/provider/package/rug.rb
puppet-7.34.0-x86-mingw32 lib/puppet/provider/package/rug.rb
puppet-7.34.0-x64-mingw32 lib/puppet/provider/package/rug.rb
puppet-7.34.0-universal-darwin lib/puppet/provider/package/rug.rb
puppet-7.33.0 lib/puppet/provider/package/rug.rb
puppet-7.33.0-x86-mingw32 lib/puppet/provider/package/rug.rb
puppet-7.33.0-x64-mingw32 lib/puppet/provider/package/rug.rb
puppet-7.33.0-universal-darwin lib/puppet/provider/package/rug.rb
puppet-7.32.1 lib/puppet/provider/package/rug.rb
puppet-7.32.1-x86-mingw32 lib/puppet/provider/package/rug.rb
puppet-7.32.1-x64-mingw32 lib/puppet/provider/package/rug.rb
puppet-7.32.1-universal-darwin lib/puppet/provider/package/rug.rb
puppet-7.31.0 lib/puppet/provider/package/rug.rb
puppet-7.31.0-x86-mingw32 lib/puppet/provider/package/rug.rb
puppet-7.31.0-x64-mingw32 lib/puppet/provider/package/rug.rb
puppet-7.31.0-universal-darwin lib/puppet/provider/package/rug.rb
puppet-7.30.0 lib/puppet/provider/package/rug.rb
puppet-7.30.0-x86-mingw32 lib/puppet/provider/package/rug.rb
puppet-7.30.0-x64-mingw32 lib/puppet/provider/package/rug.rb
puppet-7.30.0-universal-darwin lib/puppet/provider/package/rug.rb