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

Remove unused parameters from puppetmaster #824

Merged
merged 2 commits into from
Apr 16, 2020
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
8 changes: 2 additions & 6 deletions manifests/puppetmaster.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# is intented to be added to your puppetmaster
class foreman::puppetmaster (
Stdlib::HTTPUrl $foreman_url = $::foreman::puppetmaster::params::foreman_url,
Optional[String] $foreman_user = $::foreman::puppetmaster::params::foreman_user,
Optional[String] $foreman_password = $::foreman::puppetmaster::params::foreman_password,
Boolean $reports = $::foreman::puppetmaster::params::reports,
Boolean $enc = $::foreman::puppetmaster::params::enc,
Boolean $receive_facts = $::foreman::puppetmaster::params::receive_facts,
Expand All @@ -17,8 +15,6 @@
Variant[Enum[''], Stdlib::Absolutepath] $ssl_ca = $::foreman::puppetmaster::params::client_ssl_ca,
Variant[Enum[''], Stdlib::Absolutepath] $ssl_cert = $::foreman::puppetmaster::params::client_ssl_cert,
Variant[Enum[''], Stdlib::Absolutepath] $ssl_key = $::foreman::puppetmaster::params::client_ssl_key,
Enum['v2'] $enc_api = 'v2',
Enum['v2'] $report_api = 'v2',
) inherits foreman::puppetmaster::params {

case $::osfamily {
Expand All @@ -45,14 +41,14 @@
mode => '0644',
owner => 'root',
group => '0',
source => "puppet:///modules/${module_name}/foreman-report_${report_api}.rb",
source => "puppet:///modules/${module_name}/foreman-report_v2.rb",
require => Exec['Create Puppet Reports dir'],
}
}

if $enc {
file { "${puppet_etcdir}/node.rb":
source => "puppet:///modules/${module_name}/external_node_${enc_api}.rb",
source => "puppet:///modules/${module_name}/external_node_v2.rb",
mode => '0550',
owner => $puppet_user,
group => $puppet_group,
Expand Down
2 changes: 0 additions & 2 deletions manifests/puppetmaster/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

# Basic configurations
$foreman_url = "https://${lower_fqdn}"
$foreman_user = undef
$foreman_password = undef
# Should foreman act as an external node classifier (manage puppet class
# assignments)
$enc = true
Expand Down
24 changes: 14 additions & 10 deletions spec/classes/foreman_puppetmaster_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,23 @@

it 'should create puppet.yaml' do
should contain_file("#{etc_dir}/puppet/foreman.yaml")
.with_content(%r{^:url: "https://#{facts[:fqdn]}"$})
.with_content(%r{^:ssl_ca: "#{puppet_vardir}/ssl/certs/ca.pem"$})
.with_content(%r{^:ssl_cert: "#{puppet_vardir}/ssl/certs/#{facts[:fqdn]}.pem"$})
.with_content(%r{^:ssl_key: "#{puppet_vardir}/ssl/private_keys/#{facts[:fqdn]}.pem"$})
.with_content(/^:user: ""$/)
.with_content(/^:password: ""$/)
.with_content(/^:puppetdir: "#{puppet_vardir}"$/)
.with_content(/^:facts: true$/)
.with_content(/^:timeout: 60$/)
.with_content(/^:report_timeout: 60$/)
.with_mode('0640')
.with_owner('root')
.with_group('puppet')

verify_exact_contents(catalogue, "#{etc_dir}/puppet/foreman.yaml", [
"---",
":url: \"https://#{facts[:fqdn]}\"",
":ssl_ca: \"#{puppet_vardir}/ssl/certs/ca.pem\"",
":ssl_cert: \"#{puppet_vardir}/ssl/certs/#{facts[:fqdn]}.pem\"",
":ssl_key: \"#{puppet_vardir}/ssl/private_keys/#{facts[:fqdn]}.pem\"",
":puppetdir: \"#{puppet_vardir}\"",
':puppetuser: "puppet"',
':facts: true',
':timeout: 60',
':report_timeout: 60',
':threads: null',
])
end
end

Expand Down
2 changes: 0 additions & 2 deletions templates/puppet.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
:ssl_ca: "<%= @ssl_ca %>"
:ssl_cert: "<%= @ssl_cert %>"
:ssl_key: "<%= @ssl_key %>"
:user: "<%= @foreman_user %>"
:password: "<%= @foreman_password %>"
:puppetdir: "<%= @puppet_home %>"
:puppetuser: "<%= @puppet_user %>"
:facts: <%= @receive_facts %>
Expand Down