-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fde8d9b attempted to implement installing foreman-proxy-journald when the logging was set to JOURNAL. The check was comparing JOURNAL to JOURNALD. This patch corrects it and adds both unit and acceptance tests.
- Loading branch information
Showing
4 changed files
with
80 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
$directory = '/etc/foreman-proxy' | ||
$certificate = "${directory}/certificate.pem" | ||
$key = "${directory}/key.pem" | ||
|
||
# Install a proxy | ||
class { 'foreman_proxy': | ||
log => 'JOURNAL', | ||
repo => 'nightly', | ||
puppet_group => 'root', | ||
register_in_foreman => false, | ||
ssl_ca => $certificate, | ||
ssl_cert => $certificate, | ||
ssl_key => $key, | ||
} | ||
|
||
# Create the certificates - this is after the proxy because we need the user variable | ||
exec { 'Create certificate directory': | ||
command => "mkdir -p ${directory}", | ||
path => ['/bin', '/usr/bin'], | ||
creates => $directory, | ||
} | ||
-> exec { 'Generate certificate': | ||
command => "openssl req -nodes -x509 -newkey rsa:2048 -subj '/CN=${facts['fqdn']}' -keyout '${key}' -out '${certificate}' -days 365", | ||
path => ['/bin', '/usr/bin'], | ||
creates => $certificate, | ||
umask => '0022', | ||
} | ||
-> file { [$key, $certificate]: | ||
owner => $foreman_proxy::user, | ||
group => $foreman_proxy::user, | ||
mode => '0640', | ||
before => Class['foreman_proxy::service'], | ||
} |
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,37 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'Scenario: install foreman-proxy with journald' do | ||
before(:context) do | ||
case os[:family] | ||
when /redhat|fedora/ | ||
on default, 'yum -y remove foreman* tfm-*' | ||
when /debian|ubuntu/ | ||
on default, 'apt-get purge -y foreman*', { :acceptable_exit_codes => [0, 100] } | ||
end | ||
end | ||
|
||
include_examples 'the example', 'journald.pp' | ||
|
||
describe package('foreman-proxy-journald') do | ||
it { is_expected.to be_installed } | ||
end | ||
|
||
describe service('foreman-proxy') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe port(8000) do | ||
it { is_expected.not_to be_listening } | ||
end | ||
|
||
describe port(8443) do | ||
it { is_expected.to be_listening } | ||
end | ||
|
||
# Logging to the journal is broken on Travis and EL7 but works in Vagrant VMs | ||
# and regular docker containers | ||
describe command('journalctl -u foreman-proxy'), unless: ENV['TRAVIS'] == 'true' && os[:family] == 'redhat' && os[:release] =~ /^7\./ do | ||
its(:stdout) { is_expected.to match(%r{WEBrick::HTTPServer#start}) } | ||
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