Uploaded image for project: 'Modules'
  1. Modules
  2. MODULES-1507

Hiera lookup of apt::sources is not cumulative

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: apt
    • Labels:
      None
    • Template:

      Description

      Current versions of puppetlabs-apt support looking up apt::sources in hiera. But as per https://docs.puppetlabs.com/hiera/1/puppet.html#priority-only these lookups are priority-only and do not accumulate all definitions of apt::sources in the hierarchy. This seriously limits the usefulness of this feature.

      For now I'm working around it by not doing

      include apt
      

      but

        class { "apt":
          sources => hiera_hash("apt::sources")
        }
      

      Could this be implemented inside the module? The following patch seems to do it for me:

      --- a/repo/puppet/modules/apt/manifests/init.pp
      +++ b/repo/puppet/modules/apt/manifests/init.pp
      @@ -54,7 +54,6 @@ class apt(
         $purge_preferences_d  = false,
         $update_timeout       = undef,
         $update_tries         = undef,
      -  $sources              = undef,
         $fancy_progress       = undef
       ) {
       
      @@ -200,6 +199,7 @@ class apt(
         }
       
         # manage sources if present
      +  $sources = = hiera_hash("apt::sources")
         if $sources != undef {
           validate_hash($sources)
           create_resources('apt::source', $sources)
      

      It basically removes the parameter for automatic lookup and does a hash merge lookup explicitly instead.

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Unassigned
                Reporter:
                michaelweiser Michael Weiser
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: