Sha256: a2345628ce7c5946c088893c0a7fe3de2b71f9f176a9e68a618912168fae97cb

Contents?: true

Size: 786 Bytes

Versions: 9

Compression:

Stored size: 786 Bytes

Contents

Puppet::Type.type(:package).provide :aptitude, :parent => :apt, :source => :dpkg do
  desc "Package management via `aptitude`."

  has_feature :versionable

  commands :aptitude => "/usr/bin/aptitude"
  commands :aptcache => "/usr/bin/apt-cache"

  ENV['DEBIAN_FRONTEND'] = "noninteractive"

  def aptget(*args)
    args.flatten!
    # Apparently aptitude hasn't always supported a -q flag.
    args.delete("-q") if args.include?("-q")
    output = aptitude(*args)

    # Yay, stupid aptitude doesn't throw an error when the package is missing.
    if args.include?(:install) and output =~ /Couldn't find any package/
      raise Puppet::Error.new(
        "Could not find package #{self.name}"
      )
    end
  end

  def purge
    aptitude '-y', 'purge', @resource[:name]
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
puppet-2.7.1 lib/puppet/provider/package/aptitude.rb
puppet-2.6.8 lib/puppet/provider/package/aptitude.rb
puppet-2.6.7 lib/puppet/provider/package/aptitude.rb
puppet-2.6.6 lib/puppet/provider/package/aptitude.rb
puppet-2.6.5 lib/puppet/provider/package/aptitude.rb
puppet-2.6.4 lib/puppet/provider/package/aptitude.rb
puppet-2.6.3 lib/puppet/provider/package/aptitude.rb
puppet-2.6.2 lib/puppet/provider/package/aptitude.rb
puppet-2.6.1 lib/puppet/provider/package/aptitude.rb