Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[preservation_catalog/migrate] NoMethodError: undefined method `version_pathname' for nil:NilClass #1480

Closed
honeybadger bot opened this issue Apr 9, 2020 · 3 comments

Comments

@honeybadger
Copy link

honeybadger bot commented Apr 9, 2020

Backtrace

line 156 of [PROJECT_ROOT]/app/services/checksum_validator.rb: latest_signature_catalog_path
line 163 of [PROJECT_ROOT]/app/services/checksum_validator.rb: rescue in latest_signature_catalog_entries
line 160 of [PROJECT_ROOT]/app/services/checksum_validator.rb: latest_signature_catalog_entries

View full backtrace and more info at honeybadger.io

@jmartin-sul
Copy link
Member

will edit the title accordingly after more investigation, but i suspect this is due to a missing moab, and pres cat not correctly trapping for what a wholly missing moab looks like. i tested and reproduced the error by calling ChecksumValidator.new(cm).validate_checksums where cm was instantiated from a druid for which a moab didn't live where pres cat expected it. this was a druid for which the pres cat db record was migrated as part of a dry run of our upcoming prod storage migration. however, when investigating a different error, i discovered the copy that was supposed to live on the target storage was missing, and since pres cat thought this druid now lived on the target storage, using that CompleteMoab record was a convenient way to test this error message.

more backtrace:

[PROJECT_ROOT]/app/services/checksum_validator.rb:156 :in `latest_signature_catalog_path`
[PROJECT_ROOT]/app/services/checksum_validator.rb:163 :in `rescue in latest_signature_catalog_entries`
[PROJECT_ROOT]/app/services/checksum_validator.rb:160 :in `latest_signature_catalog_entries`
[PROJECT_ROOT]/app/services/checksum_validator.rb:70 :in `validate_signature_catalog_listing`
[PROJECT_ROOT]/app/services/checksum_validator.rb:59 :in `validate_signature_catalog`
[PROJECT_ROOT]/app/services/checksum_validator.rb:28 :in `validate_checksums`
[PROJECT_ROOT]/app/jobs/checksum_validation_job.rb:14 :in `perform` 

suspect moab.version_list.last is nil:

def latest_moab_version
@latest_moab_version ||= moab.version_list.last
end

@latest_signature_catalog_path ||= latest_moab_version.version_pathname.join(MANIFESTS, 'signatureCatalog.xml').to_s

def latest_signature_catalog_entries
@latest_signature_catalog_entries ||= latest_moab_version.signature_catalog.entries
rescue Errno::ENOENT, NoMethodError # e.g. latest_moab_version.signature_catalog is nil (signatureCatalog.xml does not exist)
results.add_result(AuditResults::SIGNATURE_CATALOG_NOT_IN_MOAB, signature_catalog_path: latest_signature_catalog_path)
[]
end

def validate_signature_catalog_listing
latest_signature_catalog_entries.each { |entry| validate_signature_catalog_entry(entry) }

def validate_signature_catalog
flag_unexpected_data_files
validate_signature_catalog_listing
end

def validate_checksums
validate_manifest_inventories
validate_signature_catalog

def perform(complete_moab)
ChecksumValidator.new(complete_moab).validate_checksums
end

@jmartin-sul
Copy link
Member

i suspect the thing to do is to either trap at the #validate_checksums level for unexpected standard error or #latest_signature_catalog_path for the specific error. actually, we should prob do both. latter gets marked online_moab_not_found, former... i'm not sure, but it feels like it should result in some non-ok status. hesitant to use unknown_error, but i think that's what it would be.

@jmartin-sul
Copy link
Member

spawned a couple follow on issues (#1483, #1484) related to audits and recording missing moabs, closing this since the particular error for which it was filed has been addressed (by #1481).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant