Skip to content

Commit

Permalink
FixityCheckJob uses ActiveFedora::FixityService#expected_message_dige…
Browse files Browse the repository at this point in the history
…st only with future AF version that has it
  • Loading branch information
jrochkind committed May 16, 2017
1 parent 62e8be4 commit ff79236
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/jobs/fixity_check_job.rb
Expand Up @@ -40,13 +40,16 @@ def perform(uri, file_set_id:, file_id:)
protected

def run_check(file_set_id, file_id, uri)
service = ActiveFedora::FixityService.new(uri)
begin
fixity_ok = ActiveFedora::FixityService.new(uri).check
fixity_ok = service.check
# only new versions of activefedora support returning this...
expected_result = service.expected_message_digest if service.respond_to?(:expected_message_digest)
rescue Ldp::NotFound
error_msg = 'resource not found'
end

log = ChecksumAuditLog.create!(passed: fixity_ok, file_set_id: file_set_id, checked_uri: uri, file_id: file_id)
ChecksumAuditLog.create!(passed: fixity_ok, file_set_id: file_set_id, checked_uri: uri, file_id: file_id, expected_result: expected_result)

if fixity_ok
ChecksumAuditLog.prune_history(file_set_id, checked_uri: uri)
Expand Down

0 comments on commit ff79236

Please sign in to comment.