puppetlabs / puppetlabs-apt

Puppet module to help manage Apt
https://forge.puppetlabs.com/puppetlabs/apt
Apache License 2.0
215 stars 462 forks source link

apt creates malformed sources.list.d entry #1062

Open clambertus opened 1 year ago

clambertus commented 1 year ago

Describe the Bug

puppetlabs-apt creates a malformed sources entry when an apt::source contains a location parameter that includes a [signed-by] string:

deb [ ] [signed-by=/usr/share/keyrings/datadog-archive-keyring.gpg] https://apt.datadoghq.com/ stable 7

Expected Behavior

When an apt::source location parameter contains a [string] entry, puppetlabs-apt should not prepend [ ]

Steps to Reproduce

Create an apt::source{} block with a location parameter containing a [string] such as [signed-by=/usr/share/keyrings/datadog-archive-keyring.gpg]. This can be seen 'in the wild' by attempting to install the datadog agent with https://github.com/DataDog/puppet-datadog-agent

Environment

Additional Context

The specific apt::source call from datadog is:

$location = "[signed-by=${apt_usr_share_keyring}] https://apt.datadoghq.com/"

apt::source { 'datadog':
  comment  => 'Datadog Agent Repository',
  location => $location,
  release  => $release,
  repos    => $repos,
}
clambertus commented 1 year ago

It appears this is due to using an old version of stdlib (5.0.0) as updating to 8.4.0 fixed this problem. However, the metadata.json shows a stdlib version requirement of:

"dependencies": [
    {
      "name": "puppetlabs/stdlib",
      "version_requirement": ">= 4.16.0 < 9.0.0"
    }
  ],

Perhaps the version_requirement needs updating?