Skip to content

Fix deletion in JSON Harvester#157

Open
EricSoroos wants to merge 1 commit into
ckan:masterfrom
derilinx:bug_deletion
Open

Fix deletion in JSON Harvester#157
EricSoroos wants to merge 1 commit into
ckan:masterfrom
derilinx:bug_deletion

Conversation

@EricSoroos

Copy link
Copy Markdown

Deletion in the JSON harvester is broken in 2 ways

  • The json harvester crashes in the import stage when it can't access the harvest object id: None, because the id is queued before it is generated in obj.save()
  • All of the harvest objects for the deleted dataset are set to not current before the crash, so the relationship between the dataset and the harvester is lost, so the dataset will live on in CKAN when it has been deleted from the source.

This patch fixes the crash by saving the harvest object prior to using it's id, and only clearing the harvest objects for the deleted item after it has been deleted.

@EricSoroos

Copy link
Copy Markdown
Author

Looks like tests for ckan=master are failing for unrelated reasons.

@metaodi

metaodi commented Jul 9, 2019

Copy link
Copy Markdown
Member

@EricSoroos can you write a test for your change?

@EricSoroos

Copy link
Copy Markdown
Author

Sorry, I can't get the test suite to run locally based on the README:

To run the tests, do:

    nosetests --nologcapture --ckan --with-pylons=test.ini ckanext

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

Successfully merging this pull request may close these issues.

2 participants