Skip to content

Commit b208aff

Browse files
committed
(PE-39411) Validate RBAC token on upgrade if required for compiler upgrades
1 parent b9170ef commit b208aff

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

plans/upgrade.pp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
'upgrade-replica-compilers',
6868
'finalize']] $begin_at_step = undef,
6969
) {
70+
out::message('# Validating inputs')
71+
7072
# Ensure input valid for a supported architecture
7173
$arch = peadm::assert_supported_architecture(
7274
$primary_host,
@@ -97,6 +99,11 @@
9799
$replica_postgresql_target,
98100
])
99101

102+
# Validate the RBAC token used to upgrade compilers if compilers are present
103+
if $compiler_targets and $compiler_targets.size > 0 {
104+
run_task('peadm::validate_rbac_token', $primary_target, token_file => $token_file)
105+
}
106+
100107
out::message('# Gathering information')
101108

102109
# lint:ignore:strict_indent

tasks/validate_rbac_token.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def execute!
2929
body = JSON.parse(resp.body)
3030
case resp.code
3131
when '401', '403'
32-
puts "#{resp.code} #{body['kind']}: Check your API token at #{token_file}. " +
32+
puts "#{resp.code} #{body['kind']}: \nCheck your API token at #{token_file}. " +
3333
"An alternate token file can be specified using the token_file param. \n\n" +
3434
"See https://www.puppet.com/docs/pe/latest/rbac_token_auth_intro for more details. \n"
3535
else

0 commit comments

Comments
 (0)