From 52ff53253a84fc96d23b0a62fcd7fa191348f6eb Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sun, 12 Feb 2023 16:59:27 +0100 Subject: [PATCH] Remove unnecessary exec --- manifests/certonly.pp | 1 - manifests/init.pp | 10 ---------- spec/classes/letsencrypt_spec.rb | 10 +--------- spec/defines/letsencrypt_certonly_spec.rb | 1 - 4 files changed, 1 insertion(+), 21 deletions(-) diff --git a/manifests/certonly.pp b/manifests/certonly.pp index 1eb91435..43448ad6 100644 --- a/manifests/certonly.pp +++ b/manifests/certonly.pp @@ -270,7 +270,6 @@ environment => $environment, provider => 'shell', require => [ - Exec['initialize letsencrypt'], File['/usr/local/sbin/letsencrypt-domain-validation'], ], } diff --git a/manifests/init.pp b/manifests/init.pp index 5c90de9a..d5a4c989 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -81,7 +81,6 @@ ) { if $manage_install { contain letsencrypt::install # lint:ignore:relative_classname_inclusion - Class['letsencrypt::install'] ~> Exec['initialize letsencrypt'] Class['letsencrypt::install'] -> Class['letsencrypt::renew'] } @@ -89,19 +88,10 @@ if $manage_config { contain letsencrypt::config # lint:ignore:relative_classname_inclusion - Class['letsencrypt::config'] -> Exec['initialize letsencrypt'] } contain letsencrypt::renew - # TODO: do we need this command when installing from package? - exec { 'initialize letsencrypt': - command => "${package_command} -h", - path => $facts['path'], - environment => $environment, - refreshonly => true, - } - $certificates.each |$certificate, $properties| { letsencrypt::certonly { $certificate: * => $properties } } diff --git a/spec/classes/letsencrypt_spec.rb b/spec/classes/letsencrypt_spec.rb index 9d849d64..a81fc0fe 100644 --- a/spec/classes/letsencrypt_spec.rb +++ b/spec/classes/letsencrypt_spec.rb @@ -22,10 +22,8 @@ it 'contains the correct resources' do is_expected.to contain_class('letsencrypt::install'). with(configure_epel: epel). - that_notifies('Exec[initialize letsencrypt]'). that_comes_before('Class[letsencrypt::renew]') - is_expected.to contain_exec('initialize letsencrypt').with_command('certbot -h') - is_expected.to contain_class('letsencrypt::config').that_comes_before('Exec[initialize letsencrypt]') + is_expected.to contain_class('letsencrypt::config') is_expected.to contain_class('letsencrypt::renew'). with(pre_hook_commands: [], post_hook_commands: [], @@ -87,12 +85,6 @@ end end - describe 'with custom environment variables' do - let(:additional_params) { { environment: ['FOO=bar', 'FIZZ=buzz'] } } - - it { is_expected.to contain_exec('initialize letsencrypt').with_environment(['FOO=bar', 'FIZZ=buzz']) } - end - describe 'with custom package_ensure' do let(:additional_params) { { package_ensure: '0.3.0-1.el7' } } diff --git a/spec/defines/letsencrypt_certonly_spec.rb b/spec/defines/letsencrypt_certonly_spec.rb index 88f78c58..c28a0393 100644 --- a/spec/defines/letsencrypt_certonly_spec.rb +++ b/spec/defines/letsencrypt_certonly_spec.rb @@ -42,7 +42,6 @@ it { is_expected.to contain_ini_setting('/etc/letsencrypt/cli.ini email foo@example.com') } it { is_expected.to contain_ini_setting('/etc/letsencrypt/cli.ini server https://acme-v02.api.letsencrypt.org/directory') } end - it { is_expected.to contain_exec('initialize letsencrypt') } it { is_expected.to contain_exec('letsencrypt certonly foo.example.com') } it { is_expected.to contain_exec('letsencrypt certonly foo.example.com').with_unless(['test ! -f /usr/local/sbin/letsencrypt-domain-validation', "/usr/local/sbin/letsencrypt-domain-validation #{pathprefix}/etc/letsencrypt/live/foo.example.com/cert.pem 'foo.example.com'"]) } end