Skip to content

fixtures: insert/replace scenario with files #2150

@tiborsimko

Description

@tiborsimko
Member

PR #2046 imrproved the behaviour of insert, replace, insert-or-replace mode to load records with or without files. It addressed well the main use cases behind #2039.

However, one corner case issue remains with respect to deleting previously uploaded files:

$ ./scripts/clean-instance.sh 
$ ./scripts/populate-instance.sh --skip-records
$ cernopendata fixtures records \
    -f ./cernopendata/modules/fixtures/data/records/cms-tools-vm-image.json \
    --mode insert
$ curl http://0.0.0.0:5000/record/249/files/cms-user-data.txt 
$ curl http://0.0.0.0:5000/record/249/files/cms-user-data.txt 
$ cernopendata fixtures records \
    -f ./cernopendata/modules/fixtures/data/records/cms-tools-vm-image.json \
    --mode replace --skip-files
$ curl http://0.0.0.0:5000/record/249/files/cms-user-data.txt

The detailed record page shows well that there are no files attached anymore, but the file download URL still serves the file content. One would expect to get a 404 not found in this scenario.

Reminder of wanted behaviour:

mode behaviour when PID exists behaviour when PID does not exist
insert fail upload as new
replace update as existing fail
insert or replace update existing upload as new

Both when including files or when excluding files (if -skip-files option was used).

Activity

added this to the Someday milestone on Dec 14, 2017
added a commit that references this issue on Nov 22, 2021
a5bbc6f
linked a pull request that will close this issue on Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @tiborsimko

      Issue actions

        fixtures: insert/replace scenario with files · Issue #2150 · cernopendata/opendata.cern.ch