Skip to content
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

(#780) puppetserver: don't purge metrics.conf / Use dedicated parameter for jruby profiler #781

Merged
merged 3 commits into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,11 @@
#
# $server_puppetserver_jruby9k:: For Puppetserver 5, use JRuby 9k? Defaults to false
#
# $server_puppetserver_metrics:: Enable metrics (Puppetserver 5.x only) and JRuby profiling?
# Defaults to true on Puppetserver 5.x and to false on Puppetserver 2.x
# $server_puppetserver_metrics:: Enable puppetserver http-client metrics
# Defaults to false because that's the Puppet Inc. default behaviour.
#
# $server_puppetserver_profiler:: Enable JRuby profiling.
# Defaults to false because that's the Puppet Inc. default behaviour.
#
# $server_metrics_jmx_enable:: Enable or disable JMX metrics reporter. Defaults to true
#
Expand Down Expand Up @@ -706,7 +709,8 @@
Boolean $server_allow_header_cert_info = $puppet::params::server_allow_header_cert_info,
Integer[0] $server_web_idle_timeout = $puppet::params::server_web_idle_timeout,
Boolean $server_puppetserver_jruby9k = $puppet::params::server_puppetserver_jruby9k,
Optional[Boolean] $server_puppetserver_metrics = $puppet::params::server_puppetserver_metrics,
Boolean $server_puppetserver_metrics = false,
Boolean $server_puppetserver_profiler = false,
Boolean $server_metrics_jmx_enable = $puppet::params::server_metrics_jmx_enable,
Boolean $server_metrics_graphite_enable = $puppet::params::server_metrics_graphite_enable,
String $server_metrics_graphite_host = $puppet::params::server_metrics_graphite_host,
Expand Down
10 changes: 5 additions & 5 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,11 @@
#
# $puppetserver_jruby9k:: For Puppetserver 5, use JRuby 9k? Defaults to false
#
# $puppetserver_metrics:: Enable metrics (Puppetserver 5.x only) and JRuby profiling?
# Defaults to true on Puppetserver 5.x and to false on Puppetserver 2.x
# $puppetserver_metrics:: Enable puppetserver http-client metrics
# Defaults to false because that's the Puppet Inc. default behaviour.
#
# $puppetserver_profiler:: Enable JRuby profiling.
# Defaults to false because that's the Puppet Inc. default behaviour.
#
# $metrics_jmx_enable:: Enable or disable JMX metrics reporter. Defaults to true
#
Expand Down Expand Up @@ -423,6 +425,7 @@
Boolean $allow_header_cert_info = $puppet::server_allow_header_cert_info,
Boolean $puppetserver_jruby9k = $puppet::server_puppetserver_jruby9k,
Optional[Boolean] $puppetserver_metrics = $puppet::server_puppetserver_metrics,
Boolean $puppetserver_profiler = $puppet::server_puppetserver_profiler,
Boolean $metrics_jmx_enable = $puppet::server_metrics_jmx_enable,
Boolean $metrics_graphite_enable = $puppet::server_metrics_graphite_enable,
String $metrics_graphite_host = $puppet::server_metrics_graphite_host,
Expand Down Expand Up @@ -482,9 +485,6 @@
$real_puppetserver_version = '5.3.6'
}

# Prefer the user setting,otherwise disable for Puppetserver 2.x, enabled for 5.x
$real_puppetserver_metrics = pick($puppetserver_metrics, true)

if $jvm_extra_args {
$real_jvm_extra_args = $jvm_extra_args
} else {
Expand Down
10 changes: 3 additions & 7 deletions manifests/server/puppetserver.pp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@
$server_check_for_updates = $puppet::server::check_for_updates,
$server_environment_class_cache_enabled = $puppet::server::environment_class_cache_enabled,
$server_jruby9k = $puppet::server::puppetserver_jruby9k,
$server_metrics = $puppet::server::real_puppetserver_metrics,
$server_metrics = $puppet::server::puppetserver_metrics,
$server_profiler = $puppet::server::puppetserver_profiler,
$metrics_jmx_enable = $puppet::server::metrics_jmx_enable,
$metrics_graphite_enable = $puppet::server::metrics_graphite_enable,
$metrics_graphite_host = $puppet::server::metrics_graphite_host,
Expand Down Expand Up @@ -262,13 +263,8 @@
content => template('puppet/server/puppetserver/conf.d/product.conf.erb'),
}

$metrics_conf_ensure = $server_metrics ? {
true => file,
default => absent
}

file { "${server_puppetserver_dir}/conf.d/metrics.conf":
ensure => $metrics_conf_ensure,
ensure => 'file',
content => template('puppet/server/puppetserver/conf.d/metrics.conf.erb'),
}
}
4 changes: 2 additions & 2 deletions spec/classes/puppet_server_puppetserver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
it {
should contain_file(puppetserver_conf)
.with_content(/^ # Whether to enable http-client metrics; defaults to 'true'.\n metrics-enabled: true$(.*)/)
.with_content(/^profiler: \{\n # enable or disable profiling for the Ruby code;\n enabled: true/)
.with_content(/^profiler: \{\n # enable or disable profiling for the Ruby code;\n enabled: false/)
}
it {
should contain_file('/etc/custom/puppetserver/conf.d/metrics.conf')
Expand All @@ -261,7 +261,7 @@
.with_content(/^ # Whether to enable http-client metrics; defaults to 'true'.\n metrics-enabled: false$/)
.with_content(/^profiler: \{\n # enable or disable profiling for the Ruby code;\n enabled: false/)
}
it { should contain_file('/etc/custom/puppetserver/conf.d/metrics.conf').with_ensure('absent') }
it { should contain_file('/etc/custom/puppetserver/conf.d/metrics.conf').with_ensure('file') }
end
end

Expand Down
2 changes: 1 addition & 1 deletion templates/server/puppetserver/conf.d/puppetserver.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,5 @@ http-client: {
# settings related to profiling the puppet Ruby code
profiler: {
# enable or disable profiling for the Ruby code;
enabled: <%= @server_metrics %>
enabled: <%= @server_profiler %>
}