Skip to content

sources format and ensure => absent fails #1243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

traylenator
Copy link

@traylenator traylenator commented Aug 15, 2025

Summary

apt::source{
  ensure        => absent,
  source_format => sources,
}

produces a compile error every time.

    Puppet::PreformattedError:
       Evaluation Error: Error while evaluating a Resource Statement, Apt::Setting[sources-my_source]: parameter 'content' expects a value of type Undef or String[1], got String (file: /home/steve/GIT/puppetlabs-apt/spec/fixtures/modules/apt/manifests/source.pp, line: 363) on node legion.lan

```puppet
apt::source{
  ensure        => absent,
  source_format => sources,
```

produces a compile error every time.

```
    Puppet::PreformattedError:
       Evaluation Error: Error while evaluating a Resource Statement, Apt::Setting[sources-my_source]: parameter 'content' expects a value of type Undef or String[1], got String (file: /home/steve/GIT/puppetlabs-apt/spec/fixtures/modules/apt/manifests/source.pp, line: 363) on node legion.lan
```
@traylenator traylenator requested review from bastelfreak, smortex and a team as code owners August 15, 2025 08:52
traylenator added a commit to traylenator/puppet-cvmfs that referenced this pull request Aug 15, 2025
Comment on lines +351 to +352
$header = '# no content not permitted, ignored for absent case'
$source_content = '# not content not permitted, ignored for absent case'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I struggle to process the double negation, and had to check the code to understand that these too variables are serialized as strings, concatenated, and send to some Optional[String[1]] parameter.

Can we instead act where this happen, on line 365? Something like:

    content       => if $header or $source_content { "${header}${source_content}" } else { undef },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants