puppetlabs / puppetlabs-apt

Puppet module to help manage Apt
https://forge.puppetlabs.com/puppetlabs/apt
Apache License 2.0
215 stars 462 forks source link

validation of ppa breaks ppa #1084

Closed jgrammen-agilitypr closed 1 year ago

jgrammen-agilitypr commented 1 year ago

Describe the Bug

1052 introduced validation of ppa names

  # Validate the resource name
  if $name !~ /^ppa:([a-zA-Z0-9\-_]+)\/([a-zA-z0-9\-_]+)$/ {
    fail("Invalid PPA name: ${name}")
  }

But it does not seems to account for all valid ppa names my ppa now fails https://launchpad.net/~jason.grammenos.agility/+archive/ubuntu/php-static

Invalid PPA name: ppa:jason.grammenos.agility/php-static 

Expected Behavior

valid ppa's should be acccepted

Steps to Reproduce

Steps to reproduce the behavior:

  ::apt::ppa { "ppa:jason.grammenos.agility/php-static":
    notify  => Exec['apt-update'],             # Resync package index files
    require => Package['add-apt-package'],     # Ensure system can add ppa's
  }

notice error in output

Environment

Additional Context

Add any other context about the problem here.

chelnak commented 1 year ago

Hey @jgrammen-agilitypr - wondering if this pr fixes the issue?

jgrammen-agilitypr commented 1 year ago

it does not appear to change the regex for ppa's, so no I do not think it does.

jgrammen-agilitypr commented 1 year ago

Thank you for the crazy fast fix. correct me if I am wrong but it appears that the fix has a bug in it?

if $name !~ /^ppa:([a-zA-Z0-9\-_.]+)\/([a-zA-z0-9\-_\.]+)$/ { should there not be a leading \ in front of the added . just like in the second half of the regex? ex: if $name !~ /^ppa:([a-zA-Z0-9\-_\.]+)\/([a-zA-z0-9\-_\.]+)$/ {

kenyon commented 1 year ago

Not necessary to escape a dot in a character class.