From 1891912f8472da66d9d227f7392b601a24b2f32f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Conil?= Date: Mon, 19 May 2014 15:33:06 +1000 Subject: [PATCH] Fixed regex to actually follow APT requirements Previous implementation would overwrite the file name and potentially include characters that would cause apt to ignore the pref file --- manifests/pin.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/pin.pp b/manifests/pin.pp index 2563fc4..2ce81fd 100644 --- a/manifests/pin.pp +++ b/manifests/pin.pp @@ -64,10 +64,6 @@ define apt::pin( } - $path = $order ? { - '' => "${preferences_d}/${name}.pref", - default => "${preferences_d}/${order}-${name}.pref", - } # According to man 5 apt_preferences: # The files have either no or "pref" as filename extension @@ -78,6 +74,10 @@ define apt::pin( # be silently ignored. $file_name = regsubst($title, '[^0-9a-z\-_\.]', '_', 'IG') + $path = $order ? { + '' => "${preferences_d}/${file_name}.pref", + default => "${preferences_d}/${order}-${file_name}.pref", + } file { "${file_name}.pref": ensure => $ensure, path => $path, -- 2.45.2