X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=manifests%2Fppa.pp;h=bab7b337e3dbc4918982517e35f520b9b7bcd02d;hb=eed10ea359d0fe144da90a8425cd14dc3c6c8f18;hp=bdc3593be845de50353198bc77cc0fc40a0d5b0b;hpb=6c1fd8e819cc8ffb44ac187bb0fa7051d2958cc6;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/ppa.pp b/manifests/ppa.pp index bdc3593..bab7b33 100644 --- a/manifests/ppa.pp +++ b/manifests/ppa.pp @@ -4,14 +4,18 @@ # apt::ppa{ 'ppa:openstack-ppa/bleeding-edge': } # # @param ensure -# Specifies whether the PPA should exist. Valid options: 'present' and 'absent'. +# 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. +# Optional if `puppet facts show os.distro.codename` returns your correct distribution release codename. +# +# @param dist +# Specifies the distribution of your node. Valid options: a string containing a valid distribution codename. +# Optional if `puppet facts show os.name` returns your correct distribution name. # # @param package_name # Names the package that provides the `apt-add-repository` command. Default: 'software-properties-common'. @@ -19,23 +23,24 @@ # @param package_manage # Specifies whether Puppet should manage the package that provides `apt-add-repository`. # -define apt::ppa( +define apt::ppa ( String $ensure = 'present', Optional[String] $options = $::apt::ppa_options, - Optional[String] $release = $facts['lsbdistcodename'], + Optional[String] $release = fact('os.distro.codename'), + Optional[String] $dist = $facts['os']['name'], Optional[String] $package_name = $::apt::ppa_package, Boolean $package_manage = false, ) { unless $release { - fail('lsbdistcodename fact not available: release parameter required') + fail('os.distro.codename fact not available: release parameter required') } - if $facts['lsbdistid'] == 'Debian' { + if $dist == 'Debian' { fail('apt::ppa is not currently supported on Debian.') } - if versioncmp($facts['lsbdistrelease'], '14.10') >= 0 { - $distid = downcase($facts['lsbdistid']) + if versioncmp($facts['os']['release']['full'], '14.10') >= 0 { + $distid = downcase($dist) $dash_filename = regsubst($name, '^ppa:([^/]+)/(.+)$', "\\1-${distid}-\\2") $underscore_filename = regsubst($name, '^ppa:([^/]+)/(.+)$', "\\1_${distid}_\\2") } else { @@ -50,7 +55,8 @@ define apt::ppa( $sources_list_d_filename = "${dash_filename_no_specialchars}-${release}.list" - if versioncmp($facts['lsbdistrelease'], '15.10') >= 0 { + if versioncmp($facts['os']['release']['full'], '15.10') >= 0 and + versioncmp($facts['os']['release']['full'], '21.04') < 0 { $trusted_gpg_d_filename = "${underscore_filename_no_specialchars}.gpg" } else { $trusted_gpg_d_filename = "${dash_filename_no_specialchars}.gpg"