Skip to content

Make cadir a configurable parameter#974

Merged
bastelfreak merged 2 commits intotheforeman:masterfrom
m0dular:ca_dir
Jan 5, 2026
Merged

Make cadir a configurable parameter#974
bastelfreak merged 2 commits intotheforeman:masterfrom
m0dular:ca_dir

Conversation

@m0dular
Copy link
Copy Markdown
Contributor

@m0dular m0dular commented Dec 20, 2025

Prior to this commit, the cadir setting was a hardcoded variable set to "${puppetserver_dir}/ca". This created an issue when using a non-standard cadir, such as in issue #942.

@m0dular
Copy link
Copy Markdown
Contributor Author

m0dular commented Dec 20, 2025

I wasn't 100% sure if cadir should be in the [main] or [server] section. Let me know if that needs to change.

Prior to this commit, the cadir setting was a hardcoded variable set to
"${puppetserver_dir}/ca".  This created an issue when using a
non-standard cadir, such as in issue theforeman#942.
Copy link
Copy Markdown
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The server section is IMHO the right place.

Comment thread spec/classes/puppet_server_spec.rb Outdated
Comment thread manifests/server.pp Outdated
Optional[Stdlib::Absolutepath] $puppetserver_rundir = $puppet::server_puppetserver_rundir,
Optional[Stdlib::Absolutepath] $puppetserver_logdir = $puppet::server_puppetserver_logdir,
Stdlib::Absolutepath $puppetserver_dir = $puppet::server_puppetserver_dir,
Stdlib::Absolutepath $ca_dir = $puppet::server_ca_dir,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about making ca_dir an optional parameter and later rely on puppetserver_dir by using pick()?

  $cadir = pick($ca_dir, "${puppetserver_dir}/ca")

That way users can change the puppetserver_dir easily and move the CA directory with it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also like that when we add the needed check for undef in manifests/server/config.pp

if $puppet::server::ca and $puppet::server::ca_dir

that this will not add a redundant entry for cadir in puppet.conf when using the default value, which could be an unexpected change for someone using the default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got the tests passing, let me know if there's anything else @ekohl

@m0dular m0dular requested a review from ekohl December 30, 2025 18:39
@bastelfreak bastelfreak merged commit 6e655e5 into theforeman:master Jan 5, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants