Skip to content

(#351) code_manager: Switch default to undef #352

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

Merged
merged 1 commit into from
Oct 10, 2023
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
2 changes: 1 addition & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1823,7 +1823,7 @@ Data type: `Optional[Boolean]`



Default value: `true`
Default value: `undef`

##### <a name="-peadm--install--r10k_remote"></a>`r10k_remote`

Expand Down
2 changes: 1 addition & 1 deletion plans/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
Optional[Peadm::Ldap_config] $ldap_config = undef,

# Code Manager
Optional[Boolean] $code_manager_auto_configure = true,
Optional[Boolean] $code_manager_auto_configure = undef,
Optional[String] $r10k_remote = undef,
Optional[String] $r10k_private_key_file = undef,
Optional[Peadm::Pem] $r10k_private_key_content = undef,
Expand Down
20 changes: 17 additions & 3 deletions plans/subplans/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
Hash $pe_conf_data = {},

# Code Manager
Optional[Boolean] $code_manager_auto_configure = true,
Optional[Boolean] $code_manager_auto_configure = undef,
Optional[String] $r10k_remote = undef,
Optional[String] $r10k_private_key_file = undef,
Optional[Peadm::Pem] $r10k_private_key_content = undef,
Expand Down Expand Up @@ -135,6 +135,20 @@
# either be undef or else the key content to write.
$r10k_private_key = peadm::file_or_content('r10k_private_key', $r10k_private_key_file, $r10k_private_key_content)

# enable code manager if:
# * it isn't explicitly disabled *and* the user provided r10k repo+key
# * a replica is present
# * one or multiple compiler are present
$_code_manager_auto_configure = if $r10k_private_key and $code_manager_auto_configure {
Copy link

Choose a reason for hiding this comment

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

This conditional doesn't account for the case where a user might provide just a remote and not a key, as they would if they were using an HTTPS clone URL for a public repo, which doesn't require any creds or key. Would it make sense to check for the remote to be set here instead of the key, since I think that is the minimum required for Code Manager to work properly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

derp, you're right! I had it the way you described it before and broke it during the latest rebase...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed it in #401

true
} elsif $replica_host {
true
} elsif $compiler_hosts {
true
} else {
$code_manager_auto_configure
}

Copy link
Member

Choose a reason for hiding this comment

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

Does installation of Larger or XL installations w/ replicas still succeed? If I recall correctly, Code Manager defaults to enabled in peadm because replica provisioning fails if the service is not running.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Sharpie is correct! We need code manager for HA environments. There is already a plan for those environments which for any reasons cant use code manager divert_code_manager (https://github.com/puppetlabs/puppetlabs-peadm/blob/main/plans/misc/divert_code_manager.pp). That said, it isnt great but doable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

installation with replica and/or compilers still works. In those cases code-manager is configured/enabled

# Process user input for license key (same process as for r10k private key above).
$license_key = peadm::file_or_content('license_key', $license_key_file, $license_key_content)

Expand Down Expand Up @@ -174,14 +188,14 @@
'puppet_enterprise::puppet_master_host' => $primary_target.peadm::certname(),
'pe_install::puppet_master_dnsaltnames' => $dns_alt_names,
'puppet_enterprise::puppetdb_database_host' => $primary_postgresql_target.peadm::certname(),
'puppet_enterprise::profile::master::code_manager_auto_configure' => $code_manager_auto_configure,
'puppet_enterprise::profile::master::code_manager_auto_configure' => $_code_manager_auto_configure,
'puppet_enterprise::profile::master::r10k_remote' => $r10k_remote,
'puppet_enterprise::profile::master::r10k_private_key' => $r10k_private_key ? {
undef => undef,
default => '/etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa',
},
'puppet_enterprise::profile::master::r10k_known_hosts' => $r10k_known_hosts,
} + $puppetdb_database_temp_config + $pe_conf_data)
}.delete_undef_values + $puppetdb_database_temp_config + $pe_conf_data)

$primary_postgresql_pe_conf = peadm::generate_pe_conf({
'console_admin_password' => 'not used',
Expand Down