Skip to content

apt 11.0.0 creates invalid *.source files #1252

@dhs-rec

Description

@dhs-rec

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:

  1. Update to apt 11.0.0
  2. Apply the above resources

Environment

  • Version 11.0.0.
  • Platform Debian 12/13

Additional Context

https://repolib.readthedocs.io/en/latest/deb822-format.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions