Skip to content

Commit

Permalink
(MODULES-7540) add apt-transport-https with https
Browse files Browse the repository at this point in the history
  • Loading branch information
tphoney committed Jul 27, 2018
1 parent c9e40d3 commit bbec706
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
5 changes: 5 additions & 0 deletions manifests/source.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
if ! $location {
fail('cannot create a source entry without specifying a location')
}
# 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:\/\/)/ {
ensure_packages('apt-transport-https')
}
}

$includes = merge($::apt::include_defaults, $include)
Expand Down
45 changes: 45 additions & 0 deletions spec/defines/source_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

it {
is_expected.to contain_apt__setting('list-my_source').with(ensure: 'present').without_content(%r{# my_source\ndeb-src hello.there wheezy main\n})
is_expected.not_to contain_package('apt-transport-https')
}
end
end
Expand Down Expand Up @@ -202,6 +203,50 @@
}
end

context 'with a https location, 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,
}
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
{
os: { family: 'Debian', name: 'Debian', release: { major: '10', full: '10.0' } },
lsbdistid: 'Debian',
lsbdistcodename: 'buster',
osfamily: 'Debian',
puppetversion: Puppet.version,
}
end
let :params do
{
location: 'https://foo.bar',
allow_unsigned: false,
}
end

it {
is_expected.not_to contain_package('apt-transport-https')
}
end

context 'with architecture equals x86_64' do
let :facts do
{
Expand Down

0 comments on commit bbec706

Please sign in to comment.