Skip to content

Commit

Permalink
Merge pull request voxpupuli#39 from domcleal/37-webroot-paths
Browse files Browse the repository at this point in the history
Validate presence of webroot_paths with webroot plugin
  • Loading branch information
danzilio authored Jun 15, 2016
2 parents b741cff + a304311 commit 264b20b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ letsencrypt::certonly { 'foo':
}
```

To request a certificate using the `webroot` plugin, the paths to the webroots
for all domains must be given through `webroot_paths`. If `domains` and
`webroot_paths` are not the same length, `webroot_paths` will cycle to make up
the difference.

```puppet
letsencrypt::certonly { 'foo':
domains => ['foo.example.com', 'bar.example.com'],
plugin => 'webroot',
webroot_paths => ['/var/www/foo', '/var/www/bar'],
}
```

If you need to pass a command line flag to the `letsencrypt-auto` command that
is not supported natively by this module, you can use the `additional_args`
parameter to pass those arguments:
Expand Down
2 changes: 2 additions & 0 deletions manifests/certonly.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
validate_re($plugin, ['^apache$', '^standalone$', '^webroot$'])
if $webroot_paths {
validate_array($webroot_paths)
} elsif $plugin == 'webroot' {
fail("The 'webroot_paths' parameter must be specified when using the 'webroot' plugin")
}
validate_string($letsencrypt_command)
if $additional_args {
Expand Down
6 changes: 6 additions & 0 deletions spec/defines/letsencrypt_certonly_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
it { is_expected.to contain_exec('letsencrypt certonly foo').with_command 'letsencrypt --agree-tos certonly -a webroot --webroot-path /var/www/foo -d foo.example.com --webroot-path /var/www/foo -d bar.example.com' }
end

context 'with webroot plugin and no webroot_paths' do
let(:title) { 'foo.example.com' }
let(:params) { { plugin: 'webroot' } }
it { is_expected.to raise_error Puppet::Error, /'webroot_paths' parameter must be specified/ }
end

context 'with custom plugin' do
let(:title) { 'foo.example.com' }
let(:params) { { plugin: 'apache' } }
Expand Down

0 comments on commit 264b20b

Please sign in to comment.