- 
                Notifications
    You must be signed in to change notification settings 
- Fork 470
Description
Describe the Bug
As of version 11.0.0, the apt module creates invalid *.source files which lack a Components field. I guess this is due to (from manifests/source.pp)
      # The deb822 format requires that if the Suite ($release) is a path (contains a /) that
      # the Components field be absent.
which is completely wrong. The spec says:
The Suite can specify an exact path in relation to the URI(s) provided, in which case the Components: must be omitted and suite must end with a slash ( / ). Alternatively, it may take the form of a distribution version (e.g. a version codename like disco or artful ). If the suite does not specify a path, at least one deb822-field-component must be present.
This misinterpretation leads to the following repository being created w/o the (required) Components field:
apt::source { 'mongodb':
  comment  => 'MongoDB APT repository',
  keyring  => '/etc/apt/keyrings/mongodb.gpg',
  location => ['http://repo.mongodb.org/apt/debian'],
  release  => ['bookworm/mongodb-org/6.0'],  # Does not END with slash, "Components" is required
  repos    => ['main'],
}
Result (wrong):
# This file is managed by Puppet. DO NOT EDIT.
# MongoDB APT repository
Enabled: yes
Types: deb 
URIs: http://repo.mongodb.org/apt/debian 
Suites: bookworm/mongodb-org/6.0 
Signed-By: /etc/apt/keyrings/mongodb.gpg
Here's also an example for a correct one:
apt::source { 'jenkins':
  comment  => 'Jenkins APT repository',
  keyring  => '/etc/apt/keyrings/jenkins-keyring.asc',
  location => ['https://pkg.jenkins.io/debian-stable'],
  release  => ['binary/'],   # Ends with slash, Components can be omitted
  repos    => [],
}
Result (correct):
# This file is managed by Puppet. DO NOT EDIT.
# Jenkins APT repository
Enabled: yes
Types: deb 
URIs: https://pkg.jenkins.io/debian-stable
Suites: binary/ 
Signed-By: /etc/apt/keyrings/jenkins-keyring.asc
Expected Behavior
The Components field is omitted ONLY if the Suites END with a /.
Steps to Reproduce
Steps to reproduce the behavior:
- Update to apt 11.0.0
- Apply the above resources
Environment
- Version 11.0.0.
- Platform Debian 12/13