(CONT-493) PPA validation adjustment CONT-493-ppa_validation_fix
authorLukas Audzevicius <laudzevicius24@hotmail.com>
Tue, 17 Jan 2023 16:59:08 +0000 (16:59 +0000)
committerLukas Audzevicius <laudzevicius24@hotmail.com>
Wed, 18 Jan 2023 10:26:45 +0000 (10:26 +0000)
Prior to this commit, one of our updates (https://github.com/puppetlabs/puppetlabs-apt/pull/1052)
implemented a regex validation for ppa packages that were to be
installed. However, this validation did not account for resource
names that were dotted.

This commit aims to fix this bug in our validation process so that it
works as intended.

manifests/ppa.pp
spec/defines/ppa_spec.rb

index 4e5e775181d2c1d52b8b98a1c6c056b2d86887f9..2a5b4a868de955037e5e42c1c842e1fffa387662 100644 (file)
@@ -40,7 +40,7 @@ define apt::ppa (
   }
 
   # Validate the resource name
-  if $name !~ /^ppa:([a-zA-Z0-9\-_]+)\/([a-zA-z0-9\-_\.]+)$/ {
+  if $name !~ /^ppa:([a-zA-Z0-9\-_.]+)\/([a-zA-z0-9\-_\.]+)$/ {
     fail("Invalid PPA name: ${name}")
   }
 
index b8e734d09ff294b918a5a8f25a45c8551671cca1..00424dccb75f7a3da9710a15e951bea36051a3c9 100644 (file)
@@ -78,7 +78,7 @@ describe 'apt::ppa' do
   [
     'ppa:foo!/bar',
     'ppa:foo/bar!',
-    'ppa:foo1.0/bar',
+    'ppa:foo1,0/bar',
     'ppa:foo/bar/foobar',
     '|| ls -la ||',
     '|| touch /tmp/foo.txt ||',