Skip to content

Commit

Permalink
Checkpoint to get feedback on approach
Browse files Browse the repository at this point in the history
  • Loading branch information
mjgiarlo committed Dec 12, 2019
1 parent 178f50c commit 763d58f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/services/audit_results.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def report_results(logger=Rails.logger)
candidate_workflow_results = []
result_array.each do |r|
log_result(r, logger)
if r.key?(INVALID_MOAB)
if r.key?(INVALID_MOAB) || r.key?(MOAB_NOT_FOUND)
msg = "#{workflows_msg_prefix} || #{r.values.first}"
WorkflowReporter.report_error(druid, actual_version, 'moab-valid', msg)
elsif status_changed_to_ok?(r)
Expand Down
12 changes: 10 additions & 2 deletions app/services/moab_validation_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def moab_validation_errors
if moab_errors.any?
moab_error_msgs = []
moab_errors.each do |error_hash|
error_hash.each_value { |msg| moab_error_msgs << msg }
moab_error_msgs += error_hash.values
end
results.add_result(AuditResults::INVALID_MOAB, moab_error_msgs)
end
Expand Down Expand Up @@ -68,7 +68,15 @@ def update_status(new_status)
# @param [Boolean] found_expected_version
# @return [void]
def set_status_as_seen_on_disk(found_expected_version)
return update_status('invalid_moab') if moab_validation_errors.any?
begin
return update_status('invalid_moab') if moab_validation_errors.any?
rescue Errno::ENOENT
results.add_result(AuditResults::MOAB_NOT_FOUND,
db_created_at: complete_moab.created_at.iso8601,
db_updated_at: complete_moab.updated_at.iso8601)
return update_status('online_moab_not_found')
end

return update_status('unexpected_version_on_storage') unless found_expected_version

# NOTE: subclasses which override this method should NOT perform checksum validation inside of this method!
Expand Down

0 comments on commit 763d58f

Please sign in to comment.