File tree Expand file tree Collapse file tree 6 files changed +32
-19
lines changed Expand file tree Collapse file tree 6 files changed +32
-19
lines changed Original file line number Diff line number Diff line change 1818#### Private Classes
1919
2020* ` letsencrypt::config ` : Configures the Let's Encrypt client.
21+ * ` letsencrypt::scripts ` : Deploy helper scripts scripts
2122
2223### Defined types
2324
Original file line number Diff line number Diff line change 141141 fail(" The 'webroot_paths' parameter must be specified when using the 'webroot' plugin" )
142142 }
143143
144+ include letsencrypt::scripts
145+
144146 # Wildcard-less title for use in file paths
145147 $title_nowc = regsubst($title , ' ^\*\. ' , ' ' )
146148
252254 environment => $environment ,
253255 provider => ' shell' ,
254256 require => [
255- Class[ ' letsencrypt' ],
257+ Exec[ ' initialize letsencrypt' ],
256258 File [' /usr/local/sbin/letsencrypt-domain-validation' ],
257259 ],
258260 }
Original file line number Diff line number Diff line change 102102 refreshonly => true ,
103103 }
104104
105- # Used in letsencrypt::certonly Exec["letsencrypt certonly ${title}"]
106- file { '/usr/local/sbin/letsencrypt-domain-validation' :
107- ensure => file ,
108- owner => ' root' ,
109- group => ' root' ,
110- mode => ' 0500' ,
111- source => " puppet:///modules/${module_name} /domain-validation.sh" ,
112- }
113-
114105 $certificates .each |$certificate , $properties | {
115106 letsencrypt::certonly { $certificate: * => $properties }
116107 }
Original file line number Diff line number Diff line change 1+ # @summary Deploy helper scripts scripts
2+ #
3+ # @api private
4+ #
5+ class letsencrypt::scripts () {
6+ assert_private()
7+
8+ # required in letsencrypt::certonly
9+ file { '/usr/local/sbin/letsencrypt-domain-validation' :
10+ ensure => file ,
11+ owner => ' root' ,
12+ group => ' root' ,
13+ mode => ' 0500' ,
14+ content => file (" ${module_name} /domain-validation.sh" ),
15+ }
16+ }
Original file line number Diff line number Diff line change 1919
2020 epel = facts [ :osfamily ] == 'RedHat' && facts [ :operatingsystem ] != 'Fedora'
2121
22- it 'contains File[/usr/local/sbin/letsencrypt-domain-validation]' do
23- is_expected . to contain_file ( '/usr/local/sbin/letsencrypt-domain-validation' ) .
24- with_ensure ( 'file' ) .
25- with_owner ( 'root' ) .
26- with_group ( 'root' ) .
27- with_mode ( '0500' ) .
28- with_source ( 'puppet:///modules/letsencrypt/domain-validation.sh' )
29- end
30-
3122 it 'contains the correct resources' do
3223 is_expected . to contain_class ( 'letsencrypt::install' ) .
3324 with ( configure_epel : epel ) .
151142 } }
152143 end
153144
145+ it { is_expected . to compile . with_all_deps }
154146 it { is_expected . to contain_letsencrypt__certonly ( 'foo' ) . with_domains ( %w[ lth0edae4nzfq895 nsgqqm4mbw257t9i ] ) }
155147 it { is_expected . to contain_letsencrypt__certonly ( 'a' ) . with_environment ( %w[ ABC=y9jby5nmfgmstnbk DFE=y00lt0fh1vj2amjx ] ) }
156148 end
Original file line number Diff line number Diff line change 2020 it { is_expected . to compile . with_all_deps }
2121 it { is_expected . to contain_class ( 'Letsencrypt::Install' ) }
2222 it { is_expected . to contain_class ( 'Letsencrypt::Config' ) }
23+ it { is_expected . to contain_class ( 'Letsencrypt::Scripts' ) }
24+
25+ # letsencrypt::scripts is a private class and is therefore tested in this define
26+ it 'contains the domain validation script' do
27+ is_expected . to contain_file ( '/usr/local/sbin/letsencrypt-domain-validation' ) .
28+ with_ensure ( 'file' ) .
29+ with_owner ( 'root' ) .
30+ with_group ( 'root' ) .
31+ with_mode ( '0500' ) .
32+ with_content ( %r{#!/bin/sh} )
33+ end
2334
2435 if facts [ :osfamily ] == 'FreeBSD'
2536 it { is_expected . to contain_file ( '/usr/local/etc/letsencrypt' ) }
You can’t perform that action at this time.
0 commit comments