Skip to content

"ensure => absent" leads to evaluation error if "source_format => 'sources'" #1245

@dhs-rec

Description

@dhs-rec

Describe the Bug

With

Apt::Source { source_format => 'sources' }

set globally, a simple

apt::source { 'somerepo':
  ensure => 'absent',
}

leads to the following error:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Apt::Setting[sources-somerepo]: parameter 'content' expects a value of type Undef or String[1], got String (file: /etc/puppet/code/environments/production/modules/apt/manifests/source.pp, line: 358) on node host.example.org

Expected Behavior

No evaluation error

Steps to Reproduce

Steps to reproduce the behavior:
Run the example above

Environment

  • Version 10.0.1
  • Platform Debian

Additional Context

The problematic line(s) seems to be

...
        'absent': {
          $header = undef
          $source_content = undef
        }
...
    content       => "${header}${source_content}",

which lead to content being set to an empty(?) string.

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