Skip to content

Commit

Permalink
Piv#179988532 Log all available top containers when a lookup fails
Browse files Browse the repository at this point in the history
Trying to get to the bottom of intermittent failures.
  • Loading branch information
marktriggs committed Oct 20, 2021
1 parent 91a6c61 commit e498283
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions backend/model/spreadsheet_bulk_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ def apply_instance_updates(row, ao_json, instance_updates_by_index)
sheet: SpreadsheetBuilder::SHEET_NAME,
column: "instances/#{index}/top_container_indicator",
row: row.row_number,
errors: [SpreadsheetBulkUpdater.missing_container_error(candidate_top_container)],
errors: [SpreadsheetBulkUpdater.missing_container_error(candidate_top_container, @top_containers_in_resource)],
}
end
end
Expand Down Expand Up @@ -741,7 +741,7 @@ def apply_instance_updates(row, ao_json, instance_updates_by_index)
sheet: SpreadsheetBuilder::SHEET_NAME,
column: "instances/#{index}/top_container_indicator",
row: row.row_number,
errors: [SpreadsheetBulkUpdater.missing_container_error(candidate_top_container)],
errors: [SpreadsheetBulkUpdater.missing_container_error(candidate_top_container, @top_containers_in_resource)],
}
end

Expand Down Expand Up @@ -1049,9 +1049,12 @@ def create_missing_top_containers?
end
end

def self.missing_container_error(container)
def self.missing_container_error(container, available_top_containers)
"Top container not found attached within resource: #{container.inspect}\n" +
" *** Set 'Create Missing Top Containers' to create missing Top Containers instead of seeing this error. ***"
" *** Set 'Create Missing Top Containers' to create missing Top Containers instead of seeing this error. ***\n" +
"\n" +
"The following top containers are attached within this resource:\n\n" +
available_top_containers.map {|tc| " * #{tc.inspect}\n"}.join("")
end

end

0 comments on commit e498283

Please sign in to comment.