X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=manifests%2Fppa.pp;h=d27aca4442ee8253f19333e79f3449a2876d8b04;hb=17b9ac3c7f0aaf7322eae634fb0f35eb27bf872c;hp=c9ab9559b0029ca3fad5b9167111178169670aff;hpb=945be7701917149dcb5394ba26b67507500e2738;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/ppa.pp b/manifests/ppa.pp index c9ab955..d27aca4 100644 --- a/manifests/ppa.pp +++ b/manifests/ppa.pp @@ -1,15 +1,37 @@ # ppa.pp define apt::ppa( - + $release = $::lsbdistcodename ) { - include apt - package { "python-software-properties": } + Class['apt'] -> Apt::Ppa[$title] + + include apt::params + + $sources_list_d = $apt::params::sources_list_d + + if ! $release { + fail('lsbdistcodename fact not available: release parameter required') + } + + exec { "apt-update-${name}": + command => "${apt::params::provider} update", + refreshonly => true, + } + + $filename_without_slashes = regsubst($name,'/','-','G') + $filename_without_ppa = regsubst($filename_without_slashes, '^ppa:','','G') + $sources_list_d_filename = "${filename_without_ppa}-${release}.list" + + exec { "add-apt-repository-${name}": + command => "/usr/bin/add-apt-repository ${name}", + notify => Exec["apt-update-${name}"], + creates => "${sources_list_d}/${sources_list_d_filename}", + } - exec { "/usr/bin/add-apt-repository ${name}": - require => Package["python-software-properties"], - # TODO: unless => 'check' - } + file { "${sources_list_d}/${sources_list_d_filename}": + ensure => file, + require => Exec["add-apt-repository-${name}"]; + } }