Skip to content

Commit 93608ee

Browse files
authored
Merge pull request #193 from ekohl/os-support
Drop Ubuntu 14.04 & add Debian 9/10 / Fedora 29/30 support
2 parents e7b53d7 + a142cad commit 93608ee

File tree

11 files changed

+194
-139
lines changed

11 files changed

+194
-139
lines changed

.sync.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
.travis.yml:
33
docker_sets:
44
- set: centos7-64
5-
- set: ubuntu1404-64
5+
- set: debian9-64
6+
- set: fedora29-64
7+
- set: fedora30-64
68
- set: ubuntu1604-64
79
- set: ubuntu1804-64
810
secure: "n/CVUS2upgv5DifCm/YsjBxR/11bdTRDYi1x9QK6ILa32+6ngVV2RQaIMXXJfJKYIPT8/O21tpc9C7fOBRGhRpNbl0usfvqsZS0C9UkpEx6AqT7lcRzj6pLrNn3IuChhZ0tQjNiKp9LxVTzltxr5uTFwKKCE4o534v/DLAzkzq5EAZuBWpRS1rcVHQA3o0767Gu3601yyYkZj9ySDH5RpbSdTCcNkTzwtFhr2NEvVb+2FI0RhchDSqPBfNWHV4Hn3dKuL42MNC2zjd2FYFpC8F27OXk/erUZIOZFfpZuIWypjSimfVC95a2Nb8kfQotTvQxUI1fwiB01ibUQGGkJj+mh7Utg/byBrbijpJnWRR7TT6oQ1NbIUHVXcqE1tfpbCBZ4Ws2Hqji0QoGc0fMrkt1NVlZlgbVrb9t+ctb1QcLaEPI+1Zf2a3AZhXOKA1EGx2W5DTQSWSPv57BUtFPICZENQi/ats30h+0FwtN7rjfx8Q6BIGO2D5JODI6eJC0nLNaL5UaPA0pjGRsNlZWoUzieuKG08G/rQtj/8jLq/3eLICv1cbfvj7lDPc0thPwXdrPIC9nLSisb/wdLufpqXsFku9TeBqrRHfQWImybcv7JRAeZZeHEo+tvFvZg5MSAEiPmz8zIOJOKhuMKEXlOmALmSjEhW6Ca5r7xuQ5Qwm0="

.travis.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,27 @@ matrix:
3333
services: docker
3434
- rvm: 2.5.3
3535
bundler_args: --without development release
36-
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker
36+
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker
3737
services: docker
3838
- rvm: 2.5.3
3939
bundler_args: --without development release
40-
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker
40+
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker
41+
services: docker
42+
- rvm: 2.5.3
43+
bundler_args: --without development release
44+
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=fedora29-64 BEAKER_HYPERVISOR=docker CHECK=beaker
45+
services: docker
46+
- rvm: 2.5.3
47+
bundler_args: --without development release
48+
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=fedora29-64 BEAKER_HYPERVISOR=docker CHECK=beaker
49+
services: docker
50+
- rvm: 2.5.3
51+
bundler_args: --without development release
52+
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=fedora30-64 BEAKER_HYPERVISOR=docker CHECK=beaker
53+
services: docker
54+
- rvm: 2.5.3
55+
bundler_args: --without development release
56+
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=fedora30-64 BEAKER_HYPERVISOR=docker CHECK=beaker
4157
services: docker
4258
- rvm: 2.5.3
4359
bundler_args: --without development release

README.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,6 @@ The module can integrate with [stahnma/epel](https://forge.puppetlabs.com/stahnm
2424
to set up the repo by setting the `configure_epel` parameter to `true` (the default for RedHat) and
2525
installing the module.
2626

27-
On Debian Jessie the module assumes the package certbot is available. This
28-
package can be found in jessie-backports. When using
29-
[puppetlabs/apt](https://forge.puppet.com/puppetlabs/apt) the following code
30-
can be used:
31-
32-
```puppet
33-
include apt
34-
include apt::backports
35-
apt::pin { 'jessie-backports-letsencrypt':
36-
release => 'jessie-backports',
37-
packages => prefix(['acme', 'cryptography', 'openssl', 'psutil', 'setuptools', 'pyasn1', 'pkg-resources'], 'python-'),
38-
priority => 700,
39-
}
40-
```
41-
4227
## Usage
4328

4429
### Setting up the Let's Encrypt client
@@ -171,7 +156,7 @@ Example:
171156

172157
```puppet
173158
class { 'letsencrypt::plugin::dns_rfc2136':
174-
server => '1.2.3.4',
159+
server => '192.0.2.1',
175160
key_name => 'certbot',
176161
key_secret => '[...]==',
177162
}

manifests/params.pp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# @summary Default parameters
2+
# @api private
13
class letsencrypt::params {
24
$agree_tos = true
35
$unsafe_registration = false
@@ -14,55 +16,51 @@
1416
'server' => 'https://acme-v01.api.letsencrypt.org/directory',
1517
}
1618

17-
if $facts['operatingsystem'] == 'Debian' and versioncmp($facts['operatingsystemrelease'], '8') >= 0 {
19+
if $facts['osfamily'] == 'Debian' {
1820
$install_method = 'package'
1921
$package_name = 'certbot'
2022
$package_command = 'certbot'
2123
$config_dir = '/etc/letsencrypt'
22-
} elsif $facts['operatingsystem'] == 'Ubuntu' and versioncmp($facts['operatingsystemrelease'], '16.04') == 0 {
23-
$install_method = 'package'
24-
$package_name = 'letsencrypt'
25-
$package_command = 'letsencrypt'
26-
$config_dir = '/etc/letsencrypt'
27-
} elsif $facts['operatingsystem'] == 'Ubuntu' and versioncmp($facts['operatingsystemrelease'], '18.04') >= 0 {
28-
$install_method = 'package'
29-
$package_name = 'certbot'
30-
$package_command = 'certbot'
31-
$config_dir = '/etc/letsencrypt'
32-
} elsif $facts['osfamily'] == 'RedHat' and versioncmp($facts['operatingsystemmajrelease'], '7') >= 0 {
24+
$dns_rfc2136_package_name = 'python3-certbot-dns-rfc2136'
25+
} elsif $facts['osfamily'] == 'RedHat' {
3326
$install_method = 'package'
3427
$package_name = 'certbot'
3528
$package_command = 'certbot'
3629
$config_dir = '/etc/letsencrypt'
30+
if $facts['operatingsystemmajrelease'] == '7' {
31+
$dns_rfc2136_package_name = 'python2-certbot-dns-rfc2136'
32+
} else {
33+
$dns_rfc2136_package_name = 'python3-certbot-dns-rfc2136'
34+
}
3735
} elsif $facts['osfamily'] == 'Gentoo' {
3836
$install_method = 'package'
3937
$package_name = 'app-crypt/certbot'
4038
$package_command = 'certbot'
4139
$config_dir = '/etc/letsencrypt'
40+
$dns_rfc2136_package_name = undef
4241
} elsif $facts['osfamily'] == 'OpenBSD' {
4342
$install_method = 'package'
4443
$package_name = 'certbot'
4544
$package_command = 'certbot'
4645
$config_dir = '/etc/letsencrypt'
46+
$dns_rfc2136_package_name = undef
4747
} elsif $facts['osfamily'] == 'FreeBSD' {
4848
$install_method = 'package'
4949
$package_name = 'py27-certbot'
5050
$package_command = 'certbot'
5151
$config_dir = '/usr/local/etc/letsencrypt'
52+
$dns_rfc2136_package_name = undef
5253
} else {
5354
$install_method = 'vcs'
5455
$package_name = 'letsencrypt'
5556
$package_command = 'letsencrypt'
5657
$config_dir = '/etc/letsencrypt'
58+
$dns_rfc2136_package_name = undef
5759
}
5860

5961
$config_file = "${config_dir}/cli.ini"
6062

61-
if $facts['osfamily'] == 'RedHat' {
62-
$configure_epel = $facts['os']['name'] != 'Fedora'
63-
} else {
64-
$configure_epel = false
65-
}
63+
$configure_epel = $facts['osfamily'] == 'RedHat' and $facts['os']['name'] != 'Fedora'
6664

6765
$cron_owner_group = $facts['osfamily'] ? {
6866
'OpenBSD' => 'wheel',

manifests/plugin/dns_rfc2136.pp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,25 @@
1919
# Number of seconds to wait for the DNS server to propagate the DNS-01 challenge.
2020
# [*manage_package*]
2121
# Manage the plugin package.
22+
# [*package_name*]
23+
# The name of the package to install when $manage_package is true.
2224
# [*config_dir*]
2325
# The path to the configuration directory.
2426
#
2527
class letsencrypt::plugin::dns_rfc2136 (
2628
Stdlib::Host $server,
2729
String[1] $key_name,
2830
String[1] $key_secret,
29-
String[1] $key_algorithm = $letsencrypt::params::dns_rfc2136_algorithm,
30-
Stdlib::Port $port = $letsencrypt::params::dns_rfc2136_port,
31-
Integer $propagation_seconds = $letsencrypt::params::dns_rfc2136_propagation_seconds,
31+
String[1] $key_algorithm = $letsencrypt::dns_rfc2136_algorithm,
32+
Stdlib::Port $port = $letsencrypt::dns_rfc2136_port,
33+
Integer $propagation_seconds = $letsencrypt::dns_rfc2136_propagation_seconds,
3234
Stdlib::Absolutepath $config_dir = $letsencrypt::config_dir,
33-
Boolean $manage_package = $letsencrypt::params::dns_rfc2136_manage_package,
35+
Boolean $manage_package = $letsencrypt::dns_rfc2136_manage_package,
36+
String $package_name = $letsencrypt::dns_rfc2136_package_name,
3437
) {
3538

36-
if ($manage_package) {
37-
package { 'python2-certbot-dns-rfc2136':
39+
if $manage_package {
40+
package { $package_name:
3841
ensure => installed,
3942
}
4043
}

metadata.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,22 @@
2929
{
3030
"operatingsystem": "Fedora",
3131
"operatingsystemrelease": [
32-
"29"
32+
"29",
33+
"30"
3334
]
3435
},
3536
{
3637
"operatingsystem": "Ubuntu",
3738
"operatingsystemrelease": [
38-
"14.04",
3939
"16.04",
4040
"18.04"
4141
]
4242
},
4343
{
4444
"operatingsystem": "Debian",
4545
"operatingsystemrelease": [
46-
"8"
46+
"9",
47+
"10"
4748
]
4849
},
4950
{
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
require 'spec_helper_acceptance'
2+
3+
describe 'letsencrypt::plugin::dns_rfc2136' do
4+
supported = case fact('os.family')
5+
when 'Debian'
6+
# Debian 9 has it in backports, Ubuntu started shipping in Bionic
7+
fact('os.release.major') != '9' && fact('os.release.major') != '16.04'
8+
when 'RedHat'
9+
true
10+
else
11+
false
12+
end
13+
14+
context 'with defaults values' do
15+
pp = <<-PUPPET
16+
class { 'letsencrypt' :
17+
email => '[email protected]',
18+
config => {
19+
'server' => 'https://acme-staging.api.letsencrypt.org/directory',
20+
},
21+
}
22+
class { 'letsencrypt::plugin::dns_rfc2136':
23+
server => '192.0.2.1',
24+
key_name => 'certbot',
25+
key_secret => 'secret',
26+
}
27+
PUPPET
28+
29+
if supported
30+
it 'installs letsencrypt and dns rfc2136 plugin without error' do
31+
apply_manifest(pp, catch_failures: true)
32+
end
33+
it 'installs letsencrypt and dns rfc2136 idempotently' do
34+
apply_manifest(pp, catch_changes: true)
35+
end
36+
37+
describe file('/etc/letsencrypt/dns-rfc2136.ini') do
38+
it { is_expected.to be_file }
39+
it { is_expected.to be_owned_by 'root' }
40+
it { is_expected.to be_grouped_into 'root' }
41+
it { is_expected.to be_mode 400 }
42+
end
43+
else
44+
it 'fails to install' do
45+
apply_manifest(pp, expect_failures: true)
46+
end
47+
end
48+
end
49+
end

spec/classes/letsencrypt_spec.rb

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,17 @@
6464
end
6565

6666
if facts[:osfamily] == 'RedHat'
67-
if facts[:operatingsystem] == 'Fedora'
68-
is_expected.not_to contain_class('epel')
69-
else
67+
if epel
7068
is_expected.to contain_class('epel').that_comes_before('Package[letsencrypt]')
69+
else
70+
is_expected.not_to contain_class('epel')
7171
end
72-
is_expected.to contain_class('letsencrypt::install').with(install_method: 'package')
72+
is_expected.to contain_class('letsencrypt::install').with(install_method: 'package').with(package_name: 'certbot')
7373
is_expected.to contain_class('letsencrypt').with(package_command: 'certbot')
7474
is_expected.to contain_package('letsencrypt').with(name: 'certbot')
7575
is_expected.to contain_file('/etc/letsencrypt').with(ensure: 'directory')
76-
elsif facts[:operatingsystem] == 'Debian'
77-
is_expected.to contain_class('letsencrypt::install').with(install_method: 'package')
78-
is_expected.to contain_file('/etc/letsencrypt').with(ensure: 'directory')
79-
elsif facts[:operatingsystem] == 'Ubuntu' && facts[:operatingsystemmajrelease] == '14.04'
80-
is_expected.to contain_class('letsencrypt::install').with(install_method: 'vcs')
81-
is_expected.to contain_file('/etc/letsencrypt').with(ensure: 'directory')
82-
elsif facts[:operatingsystem] == 'Ubuntu'
83-
is_expected.to contain_class('letsencrypt::install').with(install_method: 'package')
76+
elsif facts[:osfamily] == 'Debian'
77+
is_expected.to contain_class('letsencrypt::install').with(install_method: 'package').with(package_name: 'certbot')
8478
is_expected.to contain_file('/etc/letsencrypt').with(ensure: 'directory')
8579
elsif facts[:operatingsystem] == 'Gentoo'
8680
is_expected.to contain_class('letsencrypt::install').with(install_method: 'package').with(package_name: 'app-crypt/certbot')

0 commit comments

Comments
 (0)