X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=manifests%2Fppa.pp;h=402961a72a949631b9ba6ebaed7b104abefdefca;hb=112eeb831a1e0951fdd4dbaff8f880c3c226de44;hp=740d59643c02c9362b6449e1f0c0885776970b07;hpb=75f5da7040eb67b144c490ff6bb319550df4f9fe;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/ppa.pp b/manifests/ppa.pp index 740d596..402961a 100644 --- a/manifests/ppa.pp +++ b/manifests/ppa.pp @@ -1,4 +1,24 @@ -# ppa.pp +# @summary Manages PPA repositories using `add-apt-repository`. Not supported on Debian. +# +# @example Example declaration of an Apt PPA +# apt::ppa{ 'ppa:openstack-ppa/bleeding-edge': } +# +# @param ensure +# Specifies whether the PPA should exist. Valid options: 'present' and 'absent'. +# +# @param options +# Supplies options to be passed to the `add-apt-repository` command. Default: '-y'. +# +# @param release +# Optional if lsb-release is installed (unless you're using a different release than indicated by lsb-release, e.g., Linux Mint). +# Specifies the operating system of your node. Valid options: a string containing a valid LSB distribution codename. +# +# @param package_name +# Names the package that provides the `apt-add-repository` command. Default: 'software-properties-common'. +# +# @param package_manage +# Specifies whether Puppet should manage the package that provides `apt-add-repository`. +# define apt::ppa( String $ensure = 'present', Optional[String] $options = $::apt::ppa_options, @@ -7,14 +27,14 @@ define apt::ppa( Boolean $package_manage = false, ) { unless $release { - fail('lsbdistcodename fact not available: release parameter required') + fail(translate('lsbdistcodename fact not available: release parameter required')) } if $facts['lsbdistid'] == 'Debian' { - fail('apt::ppa is not currently supported on Debian.') + fail(translate('apt::ppa is not currently supported on Debian.')) } - if versioncmp($facts['lsbdistrelease'], '15.10') >= 0 { + if versioncmp($facts['lsbdistrelease'], '14.10') >= 0 { $distid = downcase($facts['lsbdistid']) $dash_filename = regsubst($name, '^ppa:([^/]+)/(.+)$', "\\1-${distid}-\\2") $underscore_filename = regsubst($name, '^ppa:([^/]+)/(.+)$', "\\1_${distid}_\\2") @@ -57,7 +77,7 @@ define apt::ppa( exec { "add-apt-repository-${name}": environment => $_proxy_env, - command => "/usr/bin/add-apt-repository ${options} ${name}", + 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',