Skip to content

Bug fixes to convert #125

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 2 commits into from
Sep 22, 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
28 changes: 20 additions & 8 deletions plans/convert.pp
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,26 @@
if $arch['high-availability'] {
$compiler_a_targets = $compiler_targets.filter |$index,$target| {
$exts = $cert_extensions[$target.peadm::target_name()]
$exts[peadm::oid('peadm_availability_group')] in ['A', 'B'] ? {
true => $exts[peadm::oid('peadm_availability_group')] == 'A',
false => $index % 2 == 0,
if ($exts[peadm::oid('peadm_availability_group')] in ['A', 'B']) {
$exts[peadm::oid('peadm_availability_group')] == 'A'
}
elsif ($exts[peadm::oid('pp_cluster')] in ['A', 'B']) {
$exts[peadm::oid('pp_cluster')] == 'A'
}
else {
$index % 2 == 0
}
}
$compiler_b_targets = $compiler_targets.filter |$index,$target| {
$exts = $cert_extensions[$target.peadm::target_name()]
$exts[peadm::oid('peadm_availability_group')] in ['A', 'B'] ? {
true => $exts[peadm::oid('peadm_availability_group')] == 'B',
false => $index % 2 != 0,
if ($exts[peadm::oid('peadm_availability_group')] in ['A', 'B']) {
$exts[peadm::oid('peadm_availability_group')] == 'B'
}
elsif ($exts[peadm::oid('pp_cluster')] in ['A', 'B']) {
$exts[peadm::oid('pp_cluster')] == 'B'
}
else {
$index % 2 != 0
}
}
}
Expand Down Expand Up @@ -193,8 +203,10 @@
}

# Run Puppet on all targets to ensure catalogs and exported resources fully
# up-to-date
run_task('peadm::puppet_runonce', $all_targets)
# up-to-date. Run on master first in case puppet server restarts, 'cause
# that would cause the runs to fail on all the rest.
run_task('peadm::puppet_runonce', $master_target)
run_task('peadm::puppet_runonce', $all_targets - $master_target)

return("Conversion to peadm Puppet Enterprise ${arch['architecture']} succeeded.")
}
13 changes: 7 additions & 6 deletions plans/util/add_cert_extensions.pp
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,19 @@
# This will be the new trusted fact data for this node
$extension_requests = $certdata[$target]['extensions'] + $extensions

# Make sure the csr_attributes.yaml file on the node matches
run_plan('peadm::util::insert_csr_extension_requests', $target,
extension_requests => $extension_requests,
merge => false,
)

# Everything starts the same; we always stop the agent and revoke the
# existing cert. We use `run_command` in case the master is 2019.x but
# the agent is only 2018.x. In that scenario `run_task(service, ...)`
# doesn't work.
$was_running = run_command('systemctl is-active puppet.service', $target, _catch_errors => true)[0].ok
if ($was_running) { run_command('systemctl stop puppet.service', $target) }

# Make sure the csr_attributes.yaml file on the node matches
run_plan('peadm::util::insert_csr_extension_requests', $target,
extension_requests => $extension_requests,
merge => false,
)

run_command("${pserver} ca clean --certname ${certname}", $master_target)

# Then things get crazy...
Expand Down