puppetlabs / puppetlabs-apt

Puppet module to help manage Apt

Home Page:https://forge.puppetlabs.com/puppetlabs/apt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Variables ($release) that are defined as undef are breaking with '' validation

mcka1n opened this issue · comments

Describe the Bug

Martin Alfke (@tuxmea) found a bug and reached out to us at the Conf Management Conference.

The issue is that this line breaks:

https://github.com/puppetlabs/puppetlabs-apt/blob/main/templates/pin.pref.epp#L6

https://github.com/puppetlabs/puppetlabs-apt/blob/main/manifests/pin.pp#L51

Because the variable changed to undef and the validation.

Expected Behavior

The validation doesn't break

Steps to Reproduce

Steps to reproduce the behavior:

  1. Use the apt module, and try to call any of the Strings defined in the module

https://github.com/puppetlabs/puppetlabs-apt/blob/main/manifests/pin.pp#L51

image

  1. Click on '....'

Environment

Additional Context

Martin might add more context about this bug

@tuxmea

Reproducing the bug:

  include apt
  apt::pin { 'test2':
    release => 'buster',
  }

Produces:

cat /etc/apt/preferences.d/test2.pref
# This file is managed by Puppet. DO NOT EDIT.
Explanation: : test2
Package: *
Pin: release a=buster, n=, v=, c=, o=, l=
Pin-Priority: 0

With my patch the result will be the following:

cat /etc/apt/preferences.d/test2.pref
# This file is managed by Puppet. DO NOT EDIT.
Explanation: : test2
Package: *
Pin: release a=buster
Pin-Priority: 0