Sha256: 29386e2fbabcfafec01e2a343af49ce125f72efa389e9d5361d32a98b8000e94

Contents?: true

Size: 1.92 KB

Versions: 28

Compression:

Stored size: 1.92 KB

Contents

# frozen_string_literal: true

Puppet::Type.type(:package).provide :dnf, :parent => :yum do
  desc "Support via `dnf`.

  Using this provider's `uninstallable` feature will not remove dependent packages. To
  remove dependent packages with this provider use the `purgeable` feature, but note this
  feature is destructive and should be used with the utmost care.

  This provider supports the `install_options` attribute, which allows command-line flags to be passed to dnf.
  These options should be specified as an array where each element is either
   a string or a hash."

  has_feature :install_options, :versionable, :virtual_packages, :install_only, :version_ranges

  commands :cmd => "dnf", :rpm => "rpm"

  # Note: this confine was borrowed from the Yum provider. The
  # original purpose (from way back in 2007) was to make sure we
  # never try to use RPM on a machine without it. We think this
  # has probably become obsolete with the way `commands` work, so
  # we should investigate removing it at some point.
  #
  # Mixing confine statements, control expressions, and exception handling
  # confuses Rubocop's Layout cops, so we disable them entirely.
  # rubocop:disable Layout
  if command('rpm')
    confine :true => begin
      rpm('--version')
      rescue Puppet::ExecutionFailure
        false
      else
        true
      end
  end
  # rubocop:enable Layout

  defaultfor 'os.name' => :fedora
  notdefaultfor 'os.name' => :fedora, 'os.release.major' => (19..21).to_a
  defaultfor 'os.family' => :redhat
  notdefaultfor 'os.family' => :redhat, 'os.release.major' => (4..7).to_a
  defaultfor 'os.name' => :amazon, 'os.release.major' => ["2023"]

  def self.update_command
    # In DNF, update is deprecated for upgrade
    'upgrade'
  end

  # The value to pass to DNF as its error output level.
  # DNF differs from Yum slightly with regards to error outputting.
  #
  # @param None
  # @return [String]
  def self.error_level
    '1'
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
puppet-8.10.0 lib/puppet/provider/package/dnf.rb
puppet-8.10.0-x86-mingw32 lib/puppet/provider/package/dnf.rb
puppet-8.10.0-x64-mingw32 lib/puppet/provider/package/dnf.rb
puppet-8.10.0-universal-darwin lib/puppet/provider/package/dnf.rb
puppet-8.9.0 lib/puppet/provider/package/dnf.rb
puppet-8.9.0-x86-mingw32 lib/puppet/provider/package/dnf.rb
puppet-8.9.0-x64-mingw32 lib/puppet/provider/package/dnf.rb
puppet-8.9.0-universal-darwin lib/puppet/provider/package/dnf.rb
puppet-8.8.1 lib/puppet/provider/package/dnf.rb
puppet-8.8.1-x86-mingw32 lib/puppet/provider/package/dnf.rb
puppet-8.8.1-x64-mingw32 lib/puppet/provider/package/dnf.rb
puppet-8.8.1-universal-darwin lib/puppet/provider/package/dnf.rb
puppet-8.7.0 lib/puppet/provider/package/dnf.rb
puppet-8.7.0-x86-mingw32 lib/puppet/provider/package/dnf.rb
puppet-8.7.0-x64-mingw32 lib/puppet/provider/package/dnf.rb
puppet-8.7.0-universal-darwin lib/puppet/provider/package/dnf.rb
puppet-8.6.0 lib/puppet/provider/package/dnf.rb
puppet-8.6.0-x86-mingw32 lib/puppet/provider/package/dnf.rb
puppet-8.6.0-x64-mingw32 lib/puppet/provider/package/dnf.rb
puppet-8.6.0-universal-darwin lib/puppet/provider/package/dnf.rb