Skip to content

Commit a781b83

Browse files
committed
(PE-39411) Add descriptive error during infrastructure upgrade when rbac token is invalid
1 parent 9a9703e commit a781b83

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tasks/puppet_infra_upgrade.rb

+8-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,14 @@ def wait_until_connected(nodes:, token_file:, timeout: 120)
7373
loop do
7474
response = https.request(request)
7575
unless response.is_a? Net::HTTPSuccess
76-
raise "Unexpected result from orchestrator: #{response.class}\n#{response}"
76+
case (response)
77+
when Net::HTTPUnauthorized
78+
raise "401 Unauthorized: Check your API token at #{token_file} has not been revoked. " +
79+
"An alternate token file can be specified using the token_file param. \n" +
80+
"See https://www.puppet.com/docs/pe/latest/rbac_token_auth_intro for more details"
81+
else
82+
raise "Unexpected result from orchestrator: #{response.class}\n#{response}"
83+
end
7784
end
7885
inventory = JSON.parse(response.body)
7986
break if inventory['items'].all? { |item| item['connected'] }

0 commit comments

Comments
 (0)