From: Eimhin Laverty Date: Thu, 6 Dec 2018 13:41:08 +0000 (+0000) Subject: (MODULES-8326) - apt-transport-https not ensured properly X-Git-Tag: 6.3.0~10^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;ds=sidebyside;h=d53a9777a6c1f6bd11396405425db863dbd791de;hp=0dba15a9c62ce4d98435eac89e0087a2ad00ce10;p=puppet-modules%2Fpuppetlabs-apt.git (MODULES-8326) - apt-transport-https not ensured properly --- diff --git a/manifests/source.pp b/manifests/source.pp index 9c50f1a..3b0b06b 100644 --- a/manifests/source.pp +++ b/manifests/source.pp @@ -88,7 +88,7 @@ define apt::source( } # Newer oses, do not need the package for HTTPS transport. $_transport_https_releases = [ 'wheezy', 'jessie', 'stretch', 'trusty', 'xenial' ] - if $_release in $_transport_https_releases and $location =~ /(?i:^https:\/\/)/ { + if ($_release in $_transport_https_releases or $facts['lsbdistcodename'] in $_transport_https_releases) and $location =~ /(?i:^https:\/\/)/ { ensure_packages('apt-transport-https') } } diff --git a/spec/defines/source_spec.rb b/spec/defines/source_spec.rb index 3436f55..69338ff 100644 --- a/spec/defines/source_spec.rb +++ b/spec/defines/source_spec.rb @@ -196,6 +196,29 @@ describe 'apt::source' do } end + context 'with a https location and custom release, install apt-transport-https' do + let :facts do + { + os: { family: 'Debian', name: 'Debian', release: { major: '8', full: '8.0' } }, + lsbdistid: 'Debian', + lsbdistcodename: 'jessie', + osfamily: 'Debian', + puppetversion: Puppet.version, + } + end + let :params do + { + location: 'HTTPS://foo.bar', + allow_unsigned: false, + release: 'customrelease', + } + end + + it { + is_expected.to contain_package('apt-transport-https') + } + end + context 'with a https location, do not install apt-transport-https on oses not in list eg buster' do let :facts do {