puppetlabs/puppet · error · Puppet::Error

Mac OS X PKG DMGs must specify a package source.

Error message

Mac OS X PKG DMGs must specify a package source.

What it means

Raised by `install` (lib/puppet/provider/package/pkgdmg.rb:149) in the macOS pkgdmg provider: the `source` attribute is the whole mechanism of this provider (it downloads a dmg/pkg from that URL), so a resource with `provider => pkgdmg` and no `source` fails immediately with Puppet::Error.

Source

Thrown at lib/puppet/provider/package/pkgdmg.rb:149

      end
    ensure
      FileUtils.remove_entry_secure(tmpdir, true)
    end
  end

  def query
    if Puppet::FileSystem.exist?("/var/db/.puppet_pkgdmg_installed_#{@resource[:name]}")
      Puppet.debug "/var/db/.puppet_pkgdmg_installed_#{@resource[:name]} found"
      { :name => @resource[:name], :ensure => :present }
    else
      nil
    end
  end

  def install
    source = @resource[:source]
    unless source
      raise Puppet::Error, _("Mac OS X PKG DMGs must specify a package source.")
    end

    name = @resource[:name]
    unless name
      raise Puppet::Error, _("Mac OS X PKG DMGs must specify a package name.")
    end

    self.class.installpkgdmg(source, name)
  end
end

View on GitHub (pinned to e227c27540)

Solutions

  1. Add the required `source` URL ending in .dmg or .pkg to the package resource.
  2. If you meant to install from a repository instead, switch to a repo-backed macOS provider (homebrew, etc.) - pkgdmg is source-only.
  3. Lint hiera data: ensure the key feeding `source` actually resolves on the node.

Example fix

# before
package { 'vlc':
  ensure   => installed,
  provider => pkgdmg,
}

# after
package { 'vlc':
  ensure   => installed,
  provider => pkgdmg,
  source   => 'https://mirror.example.com/vlc-3.0.20.dmg',
}
Defensive patterns

Strategy: validation

Validate before calling

# Guard in a wrapper defined type / lint rule
# validate_string($pkg_source) and
fail('pkgdmg package requires source') if $source =~ Undef

Prevention

When it happens

Trigger: `package { 'firefox': ensure => installed, provider => pkgdmg }` without a source attribute; a template/EPP rendering that drops the source line.

Common situations: Copy-pasted manifests missing the source; hiera data key mismatch so `source => lookup(...)` resolves to nothing.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/31b3023c6b71115e. Report an issue: GitHub.