-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refs #33760 - Add reports proxy plugin #707
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 Reports plugin | ||
# | ||
# This class installs the 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 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::reports ( | ||
Optional[String] $proxy_name = undef, | ||
Stdlib::Absolutepath $spool_dir = '/var/lib/foreman-proxy/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 { 'reports': | ||
enabled => $enabled, | ||
feature => 'Reports', | ||
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::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('reports') } | ||
it 'should contain the correct configuration in reports.yml' do | ||
verify_exact_contents(catalogue, '/etc/foreman-proxy/settings.d/reports.yml', [ | ||
'---', | ||
':enabled: https', | ||
':reported_proxy_hostname: foo.example.com', | ||
':debug_payload: false', | ||
':spool_dir: /var/lib/foreman-proxy/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::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::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::reports::keep_reports') %> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just thinking out loud: should
proxy
type automatically enable the host reporting feature? The only downside is that it wouldn't get disabled again if the users switches it toforeman
again. I'd be OK with adding a line to the parameter documentation that tells the user to enable the host_reports plugin (both the Foreman and Proxy parts)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I follow what you mean... I see there are two ways for "enabling":
report_type
toproxy
.The whole feature (for Ansible) will work only if both ways are applied. For Puppet the first one only will do (but with additional configuration of puppet client/server).
UPD: Also, for now switching
proxy
toforeman
should disable forwarding and should "return things they were". This wouldn't be the case in the future though, since we're going to remove old API and stuff.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, so I'm wondering if you set this value to
proxy
, should we do something about warning the user they'll have an incompatible setup somehow. But as I said: I'm fine with adding a line to the parameter documentation in this class that's something like "If set to proxy, the host_reports plugin must be enabled".There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right, will do.Done.