|
60 | 60 |
|
61 | 61 | out::message('# Gathering information')
|
62 | 62 |
|
| 63 | + $cert_extensions_temp = run_task('peadm::cert_data', $all_targets).reduce({}) |$memo,$result| { |
| 64 | + $memo + { $result.target.peadm::certname() => $result['extensions'] } |
| 65 | + } |
| 66 | + |
| 67 | + # Add legacy compiler role to compilers that are missing it |
| 68 | + $compilers_with_legacy_compiler_flag = $cert_extensions_temp.filter |$name,$exts| { |
| 69 | + ($name in $compiler_targets.map |$t| { $t.name } or $name in $legacy_compiler_targets.map |$t| { $t.name }) and |
| 70 | + ($exts[peadm::oid('peadm_legacy_compiler')] != undef) |
| 71 | + } |
| 72 | + |
| 73 | + if $compilers_with_legacy_compiler_flag.size > 0 { |
| 74 | + $legacy_compilers_with_flag = $compilers_with_legacy_compiler_flag.filter |$name,$exts| { |
| 75 | + $exts[peadm::oid('peadm_legacy_compiler')] == 'true' |
| 76 | + }.keys |
| 77 | + |
| 78 | + $modern_compilers_with_flag = $compilers_with_legacy_compiler_flag.filter |$name,$exts| { |
| 79 | + $exts[peadm::oid('peadm_legacy_compiler')] == 'false' |
| 80 | + }.keys |
| 81 | + |
| 82 | + if $modern_compilers_with_flag.size > 0 { |
| 83 | + run_plan('peadm::modify_certificate', $modern_compilers_with_flag, |
| 84 | + primary_host => $primary_target, |
| 85 | + remove_extensions => [peadm::oid('peadm_legacy_compiler')], |
| 86 | + ) |
| 87 | + } |
| 88 | + |
| 89 | + if $legacy_compilers_with_flag.size > 0 { |
| 90 | + run_plan('peadm::modify_certificate', $legacy_compilers_with_flag, |
| 91 | + primary_host => $primary_target, |
| 92 | + add_extensions => { |
| 93 | + 'pp_auth_role' => 'pe_compiler_legacy', |
| 94 | + }, |
| 95 | + remove_extensions => [peadm::oid('peadm_legacy_compiler'), peadm::oid('pp_auth_role')], |
| 96 | + ) |
| 97 | + } |
| 98 | + |
| 99 | + run_task('peadm::puppet_runonce', peadm::flatten_compact([ |
| 100 | + $compiler_targets, |
| 101 | + $legacy_compiler_targets, |
| 102 | + ])) |
| 103 | + } |
| 104 | + |
63 | 105 | # Get trusted fact information for all compilers. Use peadm::certname() as
|
64 | 106 | # the hash key because the apply block below will break trying to parse the
|
65 | 107 | # $compiler_extensions variable if it has Target-type hash keys.
|
|
318 | 360 | run_command('systemctl restart pe-puppetserver.service pe-puppetdb.service', $compiler_targets)
|
319 | 361 | }
|
320 | 362 |
|
| 363 | + # Update PE Master rules to support legacy compilers |
| 364 | + run_task('peadm::update_pe_master_rules', $primary_target) |
| 365 | +
|
321 | 366 | # Run puppet on all targets again to ensure everything is fully up-to-date
|
322 | 367 | run_task('peadm::puppet_runonce', $all_targets)
|
323 | 368 | }
|
|
333 | 378 | # lint:endignore
|
334 | 379 | }
|
335 | 380 |
|
336 |
| - run_task('peadm::update_pe_master_rules', $primary_target) |
337 |
| -
|
338 | 381 | return("Conversion to peadm Puppet Enterprise ${arch['architecture']} completed.")
|
339 | 382 | }
|
0 commit comments