Showing with 42 additions and 21 deletions.
  1. +9 −1 CHANGELOG.md
  2. +1 −0 REFERENCE.md
  3. +3 −1 manifests/certonly.pp
  4. +0 −9 manifests/init.pp
  5. +16 −0 manifests/scripts.pp
  6. +1 −1 metadata.json
  7. +1 −9 spec/classes/letsencrypt_spec.rb
  8. +11 −0 spec/defines/letsencrypt_certonly_spec.rb
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v8.0.1](https://github.com/voxpupuli/puppet-letsencrypt/tree/v8.0.1) (2022-01-19)
## [v8.0.2](https://github.com/voxpupuli/puppet-letsencrypt/tree/v8.0.2) (2022-02-01)

[Full Changelog](https://github.com/voxpupuli/puppet-letsencrypt/compare/v8.0.1...v8.0.2)

**Fixed bugs:**

- move scripts into a separate class [\#275](https://github.com/voxpupuli/puppet-letsencrypt/pull/275) ([nod0n](https://github.com/nod0n))

## [v8.0.1](https://github.com/voxpupuli/puppet-letsencrypt/tree/v8.0.1) (2022-01-20)

[Full Changelog](https://github.com/voxpupuli/puppet-letsencrypt/compare/v8.0.0...v8.0.1)

Expand Down
1 change: 1 addition & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#### Private Classes

* `letsencrypt::config`: Configures the Let's Encrypt client.
* `letsencrypt::scripts`: Deploy helper scripts scripts

### Defined types

Expand Down
4 changes: 3 additions & 1 deletion manifests/certonly.pp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@
fail("The 'webroot_paths' parameter must be specified when using the 'webroot' plugin")
}

include letsencrypt::scripts

# Wildcard-less title for use in file paths
$title_nowc = regsubst($title, '^\*\.', '')

Expand Down Expand Up @@ -252,7 +254,7 @@
environment => $environment,
provider => 'shell',
require => [
Class['letsencrypt'],
Exec['initialize letsencrypt'],
File['/usr/local/sbin/letsencrypt-domain-validation'],
],
}
Expand Down
9 changes: 0 additions & 9 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,6 @@
refreshonly => true,
}

# Used in letsencrypt::certonly Exec["letsencrypt certonly ${title}"]
file { '/usr/local/sbin/letsencrypt-domain-validation':
ensure => file,
owner => 'root',
group => 'root',
mode => '0500',
source => "puppet:///modules/${module_name}/domain-validation.sh",
}

$certificates.each |$certificate, $properties| {
letsencrypt::certonly { $certificate: * => $properties }
}
Expand Down
16 changes: 16 additions & 0 deletions manifests/scripts.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# @summary Deploy helper scripts scripts
#
# @api private
#
class letsencrypt::scripts () {
assert_private()

# required in letsencrypt::certonly
file { '/usr/local/sbin/letsencrypt-domain-validation':
ensure => file,
owner => 'root',
group => 'root',
mode => '0500',
content => file("${module_name}/domain-validation.sh"),
}
}
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-letsencrypt",
"version": "8.0.1",
"version": "8.0.2",
"author": "Vox Pupuli",
"summary": "Manages lets-encrypt and certbot + related certs",
"license": "Apache-2.0",
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 @@ -19,15 +19,6 @@

epel = facts[:osfamily] == 'RedHat' && facts[:operatingsystem] != 'Fedora'

it 'contains File[/usr/local/sbin/letsencrypt-domain-validation]' do
is_expected.to contain_file('/usr/local/sbin/letsencrypt-domain-validation').
with_ensure('file').
with_owner('root').
with_group('root').
with_mode('0500').
with_source('puppet:///modules/letsencrypt/domain-validation.sh')
end

it 'contains the correct resources' do
is_expected.to contain_class('letsencrypt::install').
with(configure_epel: epel).
Expand Down Expand Up @@ -151,6 +142,7 @@
} }
end

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_letsencrypt__certonly('foo').with_domains(%w[lth0edae4nzfq895 nsgqqm4mbw257t9i]) }
it { is_expected.to contain_letsencrypt__certonly('a').with_environment(%w[ABC=y9jby5nmfgmstnbk DFE=y00lt0fh1vj2amjx]) }
end
Expand Down
11 changes: 11 additions & 0 deletions spec/defines/letsencrypt_certonly_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('Letsencrypt::Install') }
it { is_expected.to contain_class('Letsencrypt::Config') }
it { is_expected.to contain_class('Letsencrypt::Scripts') }

# letsencrypt::scripts is a private class and is therefore tested in this define
it 'contains the domain validation script' do
is_expected.to contain_file('/usr/local/sbin/letsencrypt-domain-validation').
with_ensure('file').
with_owner('root').
with_group('root').
with_mode('0500').
with_content(%r{#!/bin/sh})
end

if facts[:osfamily] == 'FreeBSD'
it { is_expected.to contain_file('/usr/local/etc/letsencrypt') }
Expand Down