-
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.
Refs #33760 - Add host_reports proxy plugin
- Loading branch information
Showing
7 changed files
with
95 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# = Foreman Proxy Host Reports plugin | ||
# | ||
# This class installs the Host Reports plugin | ||
# | ||
# === Parameters: | ||
# | ||
# $keep_reports:: Keep sent reports in spool_dir directory | ||
# when enabled, move files from the place on | ||
# a regular basis (e.g. via cronjob). | ||
# | ||
# === Advanced parameters: | ||
# | ||
# $proxy_name:: Proxy hostname to appear in reports JSON | ||
# | ||
# $spool_dir:: Spool directory with processed reports | ||
# | ||
# $enabled:: enables/disables the host_reports plugin | ||
# | ||
# $listen_on:: proxy feature listens on http, https, or both | ||
# | ||
# $version:: plugin package version, it's passed to ensure parameter of package resource | ||
# can be set to specific version number, 'latest', 'present' etc. | ||
# | ||
class foreman_proxy::plugin::host_reports ( | ||
Optional[String] $proxy_name = undef, | ||
Stdlib::Absolutepath $spool_dir = '/var/lib/foreman-proxy/host_reports', | ||
Boolean $keep_reports = false, | ||
Boolean $enabled = true, | ||
Foreman_proxy::ListenOn $listen_on = 'https', | ||
Optional[String] $version = undef, | ||
) { | ||
$reported_proxy_hostname = pick($proxy_name, $foreman_proxy::registered_name) | ||
|
||
foreman_proxy::plugin::module { 'host_reports': | ||
enabled => $enabled, | ||
feature => 'HostReports', | ||
listen_on => $listen_on, | ||
version => $version, | ||
} | ||
} |
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,24 @@ | ||
require 'spec_helper' | ||
|
||
describe 'foreman_proxy::plugin::host_reports' do | ||
on_plugin_os.each do |os, os_facts| | ||
context "on #{os}" do | ||
let(:facts) { os_facts } | ||
let(:pre_condition) { 'include foreman_proxy' } | ||
|
||
describe 'with default settings' do | ||
it { should contain_foreman_proxy__plugin__module('host_reports') } | ||
it 'should contain the correct configuration in host_reports.yml' do | ||
verify_exact_contents(catalogue, '/etc/foreman-proxy/settings.d/host_reports.yml', [ | ||
'---', | ||
':enabled: https', | ||
':reported_proxy_hostname: foo.example.com', | ||
':debug_payload: false', | ||
':spool_dir: /var/lib/foreman-proxy/host_reports', | ||
':keep_reports: false' | ||
]) | ||
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
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,17 @@ | ||
--- | ||
# Use https for production deployments. http and true only make sense in development | ||
:enabled: <%= @module_enabled %> | ||
|
||
# Proxy hostname to appear in reports JSON | ||
:reported_proxy_hostname: <%= scope.lookupvar('foreman_proxy::plugin::host_reports::reported_proxy_hostname') %> | ||
|
||
# Print input and output to the debug level | ||
:debug_payload: false | ||
|
||
# Spool directory with processed reports | ||
:spool_dir: <%= scope.lookupvar('foreman_proxy::plugin::host_reports::spool_dir') %> | ||
|
||
# Keep sent reports in spool_dir/done directory | ||
# - when enabled, move files from the place on | ||
# a regular basis (e.g. via cronjob). | ||
:keep_reports: <%= scope.lookupvar('foreman_proxy::plugin::host_reports::keep_reports') %> |