X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=manifests%2Fppa.pp;h=99af21937529d983cfa4e590ef8e48c7bd3285a9;hb=6574d464c06b0f21f7ab3cf4a5b4151e1ad705f5;hp=a67e1a19457e204ce7e5cfb1237115b0081bbc0d;hpb=a541b4ee32ea39f3eb23d4ffa3311daba61d1118;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/ppa.pp b/manifests/ppa.pp index a67e1a1..99af219 100644 --- a/manifests/ppa.pp +++ b/manifests/ppa.pp @@ -16,14 +16,25 @@ define apt::ppa( if versioncmp($facts['lsbdistrelease'], '15.10') >= 0 { $distid = downcase($facts['lsbdistid']) - $filename = regsubst($name, '^ppa:([^/]+)/(.+)$', "\\1-${distid}-\\2-${release}") + $dash_filename = regsubst($name, '^ppa:([^/]+)/(.+)$', "\\1-${distid}-\\2") + $underscore_filename = regsubst($name, '^ppa:([^/]+)/(.+)$', "\\1_${distid}_\\2") } else { - $filename = regsubst($name, '^ppa:([^/]+)/(.+)$', "\\1-\\2-${release}") + $dash_filename = regsubst($name, '^ppa:([^/]+)/(.+)$', "\\1-\\2") + $underscore_filename = regsubst($name, '^ppa:([^/]+)/(.+)$', "\\1_\\2") } - $filename_no_slashes = regsubst($filename, '/', '-', 'G') - $filename_no_specialchars = regsubst($filename_no_slashes, '[\.\+]', '_', 'G') - $sources_list_d_filename = "${filename_no_specialchars}.list" + $dash_filename_no_slashes = regsubst($dash_filename, '/', '-', 'G') + $dash_filename_no_specialchars = regsubst($dash_filename_no_slashes, '[\.\+]', '_', 'G') + $underscore_filename_no_slashes = regsubst($underscore_filename, '/', '-', 'G') + $underscore_filename_no_specialchars = regsubst($underscore_filename_no_slashes, '[\.\+]', '_', 'G') + + $sources_list_d_filename = "${dash_filename_no_specialchars}-${release}.list" + + if versioncmp($facts['lsbdistrelease'], '15.10') >= 0 { + $trusted_gpg_d_filename = "${underscore_filename_no_specialchars}.gpg" + } else { + $trusted_gpg_d_filename = "${dash_filename_no_specialchars}.gpg" + } if $ensure == 'present' { if $package_manage { @@ -46,8 +57,8 @@ define apt::ppa( exec { "add-apt-repository-${name}": environment => $_proxy_env, - command => "/usr/bin/add-apt-repository ${options} ${name}", - unless => "/usr/bin/test -f ${::apt::sources_list_d}/${sources_list_d_filename}", + command => "/usr/bin/add-apt-repository ${options} ${name} || (rm ${::apt::sources_list_d}/${sources_list_d_filename} && false)", + unless => "/usr/bin/test -f ${::apt::sources_list_d}/${sources_list_d_filename} && /usr/bin/test -f ${::apt::trusted_gpg_d}/${trusted_gpg_d_filename}", user => 'root', logoutput => 'on_failure', notify => Class['apt::update'],