From d28c04b88f4f192823fd3996038a04a1874f3b1e Mon Sep 17 00:00:00 2001 From: Dominic Cleal Date: Wed, 25 May 2016 12:41:43 +0100 Subject: [PATCH] Change EL7 package and command to certbot certbot has replaced letsencrypt in EPEL7: https://apps.fedoraproject.org/packages/certbot https://apps.fedoraproject.org/packages/letsencrypt --- manifests/params.pp | 18 ++++++++++-------- spec/classes/letsencrypt_spec.rb | 4 +++- spec/defines/letsencrypt_certonly_spec.rb | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index c4cef9ca..65f78180 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -16,14 +16,24 @@ if $::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '9') >= 0 { $install_method = 'package' + $package_name = 'letsencrypt' + $package_command = 'letsencrypt' } elsif $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '16.04') >= 0 { $install_method = 'package' + $package_name = 'letsencrypt' + $package_command = 'letsencrypt' } elsif $::osfamily == 'RedHat' and versioncmp($::operatingsystemmajrelease, '7') >= 0 { $install_method = 'package' + $package_name = 'certbot' + $package_command = 'certbot' } elsif $::osfamily == 'Gentoo' { $install_method = 'package' + $package_name = 'app-crypt/certbot' + $package_command = 'certbot' } else { $install_method = 'vcs' + $package_name = 'letsencrypt' + $package_command = 'letsencrypt' } if $::osfamily == 'RedHat' { @@ -31,12 +41,4 @@ } else { $configure_epel = false } - - if $::osfamily == 'Gentoo' { - $package_name = 'app-crypt/certbot' - $package_command = 'certbot' - } else { - $package_name = 'letsencrypt' - $package_command = 'letsencrypt' - } } diff --git a/spec/classes/letsencrypt_spec.rb b/spec/classes/letsencrypt_spec.rb index 77b5e2bf..dea08c3d 100644 --- a/spec/classes/letsencrypt_spec.rb +++ b/spec/classes/letsencrypt_spec.rb @@ -82,7 +82,7 @@ end describe 'with install_method => package' do - let(:additional_params) { { install_method: 'package' } } + let(:additional_params) { { install_method: 'package', package_command: 'letsencrypt' } } it { is_expected.to contain_class('letsencrypt::install').with_install_method('package') } it { is_expected.to contain_exec('initialize letsencrypt').with_command('letsencrypt -h') } end @@ -142,6 +142,8 @@ it 'should contain the correct resources' do is_expected.to contain_class('epel').that_comes_before('Package[letsencrypt]') is_expected.to contain_class('letsencrypt::install').with(install_method: 'package') + is_expected.to contain_class('letsencrypt').with(package_command: 'certbot') + is_expected.to contain_package('letsencrypt').with(name: 'certbot') end end end diff --git a/spec/defines/letsencrypt_certonly_spec.rb b/spec/defines/letsencrypt_certonly_spec.rb index 5fe4bbb2..093b8489 100644 --- a/spec/defines/letsencrypt_certonly_spec.rb +++ b/spec/defines/letsencrypt_certonly_spec.rb @@ -2,7 +2,7 @@ {'Debian' => '9.0', 'Ubuntu' => '16.04', 'RedHat' => '7.2'}.each do |osfamily, osversion| context "on #{osfamily} based operating systems" do let(:facts) { { osfamily: osfamily, operatingsystem: osfamily, operatingsystemrelease: osversion, operatingsystemmajrelease: osversion.split('.').first, path: '/usr/bin' } } - let(:pre_condition) { "class { letsencrypt: email => 'foo@example.com' }" } + let(:pre_condition) { "class { letsencrypt: email => 'foo@example.com', package_command => 'letsencrypt' }" } context 'with a single domain' do let(:title) { 'foo.example.com' }