-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It was strange to me that the module mentions the apache plugin, but has no installation of said plugin anywhere. In the meantime i used standalone and did an ugly cron pre/post combo But this should address the issue properly * adds the plugin class 'apache' * adds python2 package names for old EL7 distro's * includes green tests.
- Loading branch information
1 parent
e6acdf5
commit e9180cc
Showing
7 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# @summary install and configure the Let's Encrypt apache plugin | ||
# | ||
# @param manage_package Manage the plugin package. | ||
# @param package_name The name of the package to install when $manage_package is true. | ||
class letsencrypt::plugin::apache ( | ||
Boolean $manage_package = true, | ||
String[1] $package_name = 'python3-certbot-apache', | ||
) { | ||
include letsencrypt | ||
|
||
if $manage_package { | ||
package { $package_name: | ||
ensure => $letsencrypt::package_ensure, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper_acceptance' | ||
|
||
describe 'letsencrypt::plugin::apache' do | ||
it_behaves_like 'an idempotent resource' do | ||
let(:manifest) do | ||
<<-PUPPET | ||
include letsencrypt | ||
include letsencrypt::plugin::apache | ||
PUPPET | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe 'letsencrypt::plugin::apache' do | ||
on_supported_os.each do |os, os_facts| | ||
context "on #{os}" do | ||
let(:facts) { os_facts } | ||
let(:params) { {} } | ||
let(:pre_condition) do | ||
<<-PUPPET | ||
class { 'letsencrypt': | ||
email => 'foo@example.com', | ||
} | ||
PUPPET | ||
end | ||
let(:package_name) do | ||
if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7' | ||
'python2-certbot-apache' | ||
else | ||
'python3-certbot-apache' | ||
end | ||
end | ||
|
||
context 'with default parameters' do | ||
it { is_expected.to compile.with_all_deps } | ||
|
||
it 'installs the certbot apache plugin' do | ||
is_expected.to contain_class('letsencrypt::plugin::apache') | ||
is_expected.to contain_package(package_name).with_ensure('installed') | ||
end | ||
|
||
describe 'with manage_package => false' do | ||
let(:params) { super().merge(manage_package: false, package_name: 'apache-package') } | ||
|
||
it { is_expected.not_to contain_package('apache-package') } | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters