Skip to content

Commit

Permalink
Merge pull request #309 from deric/cleanup
Browse files Browse the repository at this point in the history
Remove unnecessary exec
  • Loading branch information
ekohl authored Feb 12, 2023
2 parents 3e2621e + 52ff532 commit 51878bb
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 21 deletions.
1 change: 0 additions & 1 deletion manifests/certonly.pp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@
environment => $environment,
provider => 'shell',
require => [
Exec['initialize letsencrypt'],
File['/usr/local/sbin/letsencrypt-domain-validation'],
],
}
Expand Down
10 changes: 0 additions & 10 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,17 @@
) {
if $manage_install {
contain letsencrypt::install # lint:ignore:relative_classname_inclusion
Class['letsencrypt::install'] ~> Exec['initialize letsencrypt']
Class['letsencrypt::install'] -> Class['letsencrypt::renew']
}

$command = $package_command

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 }
}
Expand Down
10 changes: 1 addition & 9 deletions spec/classes/letsencrypt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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: [],
Expand Down Expand Up @@ -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' } }

Expand Down
1 change: 0 additions & 1 deletion spec/defines/letsencrypt_certonly_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
it { is_expected.to contain_ini_setting('/etc/letsencrypt/cli.ini email [email protected]') }
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
Expand Down

0 comments on commit 51878bb

Please sign in to comment.