{"record":{"id":"31b3023c6b71115e","repo":"puppetlabs/puppet","slug":"mac-os-x-pkg-dmgs-must-specify-a-package-source","errorCode":null,"errorMessage":"Mac OS X PKG DMGs must specify a package source.","messagePattern":"Mac OS X PKG DMGs must specify a package source\\.","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/provider/package/pkgdmg.rb","lineNumber":149,"sourceCode":"      end\n    ensure\n      FileUtils.remove_entry_secure(tmpdir, true)\n    end\n  end\n\n  def query\n    if Puppet::FileSystem.exist?(\"/var/db/.puppet_pkgdmg_installed_#{@resource[:name]}\")\n      Puppet.debug \"/var/db/.puppet_pkgdmg_installed_#{@resource[:name]} found\"\n      { :name => @resource[:name], :ensure => :present }\n    else\n      nil\n    end\n  end\n\n  def install\n    source = @resource[:source]\n    unless source\n      raise Puppet::Error, _(\"Mac OS X PKG DMGs must specify a package source.\")\n    end\n\n    name = @resource[:name]\n    unless name\n      raise Puppet::Error, _(\"Mac OS X PKG DMGs must specify a package name.\")\n    end\n\n    self.class.installpkgdmg(source, name)\n  end\nend\n","sourceCodeStart":131,"sourceCodeEnd":160,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/provider/package/pkgdmg.rb#L131-L160","documentation":"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.","triggerScenarios":"`package { 'firefox': ensure => installed, provider => pkgdmg }` without a source attribute; a template/EPP rendering that drops the source line.","commonSituations":"Copy-pasted manifests missing the source; hiera data key mismatch so `source => lookup(...)` resolves to nothing.","solutions":["Add the required `source` URL ending in .dmg or .pkg to the package resource.","If you meant to install from a repository instead, switch to a repo-backed macOS provider (homebrew, etc.) - pkgdmg is source-only.","Lint hiera data: ensure the key feeding `source` actually resolves on the node."],"exampleFix":"# before\npackage { 'vlc':\n  ensure   => installed,\n  provider => pkgdmg,\n}\n\n# after\npackage { 'vlc':\n  ensure   => installed,\n  provider => pkgdmg,\n  source   => 'https://mirror.example.com/vlc-3.0.20.dmg',\n}","handlingStrategy":"validation","validationCode":"# Guard in a wrapper defined type / lint rule\n# validate_string($pkg_source) and\nfail('pkgdmg package requires source') if $source =~ Undef","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Wrap pkgdmg resources in a defined type that declares `source` as a required parameter.","Lint manifests: every `provider => pkgdmg` package must carry a source attribute.","Validate hiera lookups that feed `source` on the node."],"tags":["macos","pkgdmg","missing-attribute","source"],"backgroundTag":"missing-required-parameter","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}