{"record":{"id":"a62da323a11d2362","repo":"puppetlabs/puppet","slug":"cannot-have-both-enable-only-true-and-flavor","errorCode":null,"errorMessage":"Cannot have both `enable_only => true` and `flavor`","messagePattern":"Cannot have both `enable_only => true` and `flavor`","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/type/package.rb","lineNumber":520,"sourceCode":"      newvalues(:true, :false)\n    end\n\n    newparam(:enable_only, :boolean => false, :parent => Puppet::Parameter::Boolean) do\n      desc <<-EOT\n        Tells `dnf module` to only enable a specific module, instead\n        of installing its default profile.\n\n        Modules with no default profile will be enabled automatically\n        without the use of this parameter.\n\n        Conflicts with the `flavor` property, which selects a profile\n        to install.\n      EOT\n      defaultto false\n\n      validate do |value|\n        if [true, :true, \"true\"].include?(value) && @resource[:flavor]\n          raise ArgumentError, _('Cannot have both `enable_only => true` and `flavor`')\n        end\n        if [:disabled, \"disabled\"].include?(@resource[:ensure])\n          raise ArgumentError, _('Cannot have both `ensure => disabled` and `enable_only => true`')\n        end\n      end\n    end\n\n    newparam(:install_only, :boolean => false, :parent => Puppet::Parameter::Boolean, :required_features => :install_only) do\n      desc <<-EOT\n        It should be set for packages that should only ever be installed,\n        never updated. Kernels in particular fall into this category.\n      EOT\n      defaultto false\n    end\n\n    newparam(:install_options, :parent => Puppet::Parameter::PackageOptions, :required_features => :install_options) do\n      desc <<-EOT\n        An array of additional options to pass when installing a package. These","sourceCodeStart":502,"sourceCodeEnd":538,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/type/package.rb#L502-L538","documentation":"The package type's enable_only parameter (DNF module enablement without install) validates against flavor: `enable_only => true` together with a selected flavor/profile is contradictory and raises 'Cannot have both `enable_only => true` and `flavor`'. The same validate block separately rejects ensure => disabled combined with enable_only.","triggerScenarios":"`package { 'nodejs': provider => dnf, enable_only => true, flavor => 'development' }`; Hiera defaults setting flavor for all DNF module packages while one resource adds enable_only => true; modules templating both flags from one data hash.","commonSituations":"DNF module workflows migrating from flavor-based installs to enable-only; layered Hiera data written by different teams each owning one key; copy-pasted examples from module READMEs that include both attributes.","solutions":["Drop one of the pair: either `enable_only => true` with no flavor, or `flavor => '...'` with a normal ensure.","Gate flavor in data: `flavor => $enable_only ? { true => undef, default => 'development' }`.","Check `puppet lookup enable_only` / `puppet lookup flavor` per node to find which layer sets each.","If the intent is 'enable the default profile', use enable_only alone."],"exampleFix":"// before\npackage { 'nodejs':\n  provider    => 'dnf',\n  enable_only => true,\n  flavor      => 'development',\n}\n\n// after\npackage { 'nodejs':\n  provider    => 'dnf',\n  enable_only => true,\n}","handlingStrategy":"validation","validationCode":"// Puppet\nif $enable_only in [true, :true, 'true'] and $flavor != undef {\n  fail('enable_only cannot be combined with flavor')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick one of enable_only or flavor per DNF module package.","Gate flavor in data on the enable_only value.","Check which Hiera layer sets each key with puppet lookup --explain."],"tags":["puppet","package","dnf","modules","mutually-exclusive"],"backgroundTag":"mutually-exclusive-parameters","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}