in cookbooks/aws-parallelcluster-platform/libraries/write_chef_error_handler.rb [19:74]
def report
extend Chef::Mixin::ShellOut
error_file = node['cluster']['bootstrap_error_path']
unless File.exist?(error_file)
message_error = 'Failed to run chef recipe.'
message_logs_to_check = \
'Please check /var/log/chef-client.log in the head node, or check the chef-client.log in CloudWatch logs.'
message_troubleshooting_link = 'Please refer to'\
' https://docs.aws.amazon.com/parallelcluster/latest/ug/troubleshooting-v3.html'\
' for more details.'
failed_action_collection = action_collection.filtered_collection(
up_to_date: false, skipped: false, updated: false, failed: true, unprocessed: false
)
mount_message_mapping = {
"add ebs" => "Failed to mount EBS volume.",
"add raid" => "Failed to mount RAID array.",
"mount efs" => "Failed to mount EFS.",
"mount fsx" => "Failed to mount FSX.",
}
protected_mode_exception =
"Cluster has been set to PROTECTED mode due to failures detected in static node provisioning"
exception_message_mapping = {
protected_mode_exception =>
protected_mode_exception + ".",
}
failed_action_collection.each do |action_record|
next unless action_record.nesting_level == 0
message_error = exception_message_mapping[
action_record.exception.message] || mount_message_mapping[
action_record.new_resource.name] || "Failed to run chef recipe#{get_recipe_info(action_record)}."
break
end
shell_out("echo '#{message_error} #{message_logs_to_check} #{message_troubleshooting_link}'> '#{error_file}'")
end
end