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

Add candlepin.consumer.facts.match_regex parameter to candlepin class #262

Merged
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
1 change: 1 addition & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
'oauth_key' => $candlepin::_oauth_key,
'oauth_secret' => $candlepin::_oauth_secret,
'db_manage_on_startup' => $candlepin::db_manage_on_startup,
'facts_match_regex' => $candlepin::facts_match_regex,
}

concat::fragment { 'General Config':
Expand Down
5 changes: 5 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
# @param db_port
# Port the database listens on. Only needs to be provided if different from
# standard port of the :db_type.

# @param facts_match_regex
# Optional regex to filter consumer facts; if provided, will be added to the
# Candlepin configuration file.
#
# @param db_ssl
# Boolean indicating if the connection to the database should be over an SSL
Expand Down Expand Up @@ -183,6 +187,7 @@
Enum['postgresql','mysql'] $db_type = 'postgresql',
Stdlib::Host $db_host = 'localhost',
Optional[Stdlib::Port] $db_port = undef,
Optional[String[1]] $facts_match_regex = undef,
Boolean $db_ssl = false,
Boolean $db_ssl_verify = true,
Optional[Stdlib::Absolutepath] $db_ssl_ca = undef,
Expand Down
11 changes: 11 additions & 0 deletions spec/classes/candlepin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,17 @@
it { is_expected.to contain_exec('notification').that_notifies('Service[tomcat]') }
it { is_expected.to contain_exec('dependency').that_requires('Service[tomcat]') }
end

describe 'with facts match regex' do
let(:params) { { facts_match_regex: 'test_match_regex' } }

it { is_expected.to compile.with_all_deps }

it do
is_expected.to contain_concat__fragment('General Config').
with_content(sensitive(/^candlepin.consumer.facts.match_regex=test_match_regex$/))
end
end
end
end
end
5 changes: 5 additions & 0 deletions templates/candlepin.conf.epp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Stdlib::Absolutepath $ca_key,
Optional[Sensitive[String]] $ca_key_password,
Optional[String] $consumer_system_name_pattern,
Optional[String[1]] $facts_match_regex,
Boolean $enable_basic_auth,
Boolean $enable_trusted_auth,
Boolean $env_filtering_enabled,
Expand Down Expand Up @@ -51,3 +52,7 @@ candlepin.async.jobs.ExpiredPoolsCleanupJob.schedule=<%= $expired_pools_schedule
log4j.logger.<%= $logger %>=<%= $log_level %>
<% } %>
<% } %>

<% if $facts_match_regex { %>
candlepin.consumer.facts.match_regex=<%= $facts_match_regex %>
<% } %>