mjordan / islandora_workbench

A command-line tool for managing content in an Islandora 2 repository
MIT License
26 stars 38 forks source link

Error during rollback #776

Open dara2 opened 2 months ago

dara2 commented 2 months ago

I am on the latest Workbench. I tried to run the rollback.yml, and while it worked earlier, now I get an error. I'm wondering if it's related to the fact that I have "additional media" files that I'm trying to roll back. Here's the log output:

islandora@ip-172-17-0-36:/opt/islandora_workbench$ ./workbench --config rollback.yml
OK, connection to Drupal at https://digitalarchive-staging.wlu.edu verified.
"Delete" task started using config file rollback.yml.
Node https://digitalarchive-staging.wlu.edu/node/256 deleted.
Node https://digitalarchive-staging.wlu.edu/node/257 deleted.
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /opt/islandora_workbench/./workbench:958 in delete                           │
│                                                                              │
│    955 │   │   │   │   for media in media_response_body:                     │
│    956 │   │   │   │   │   if "mid" in media:                                │
│    957 │   │   │   │   │   │   media_id = media["mid"][0]["value"]           │
│ ❱  958 │   │   │   │   │   │   media_delete_status_code = remove_media_and_f │
│    959 │   │   │   │   │   │   │   config, media_id                          │
│    960 │   │   │   │   │   │   )                                             │
│    961 │   │   │   │   │   │   if media_delete_status_code == 204:           │
│                                                                              │
│ /opt/islandora_workbench/workbench_utils.py:5388 in remove_media_and_file    │
│                                                                              │
│    5385 │   media_bundle_name = get_media_response_body["bundle"][0]["target │
│    5386 │   if media_bundle_name in config["media_track_file_fields"]:       │
│    5387 │   │   track_file_field = config["media_track_file_fields"][media_b │
│ ❱  5388 │   │   if track_file_field in get_media_response_body[track_file_fi │
│    5389 │   │   │   for track_file in get_media_response_body[track_file_fie │
│    5390 │   │   │   │   track_file_id = track_file["target_id"]              │
│    5391 │   │   │   │   track_file_endpoint = (                              │
╰──────────────────────────────────────────────────────────────────────────────╯
KeyError: 'field_track'

During handling of the above exception, another exception occurred:

╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /opt/islandora_workbench/./workbench:3476 in <module>                        │
│                                                                              │
│   3473 │   if config["task"] == "update":                                    │
│   3474 │   │   update()                                                      │
│   3475 │   if config["task"] == "delete":                                    │
│ ❱ 3476 │   │   delete()                                                      │
│   3477 │   if config["task"] == "add_media":                                 │
│   3478 │   │   add_media()                                                   │
│   3479 │   if config["task"] == "delete_media":                              │
│                                                                              │
│ /opt/islandora_workbench/./workbench:978 in delete                           │
│                                                                              │
│    975 │   │   │   │   │   + " not deleted. See log for more detail."        │
│    976 │   │   │   │   )                                                     │
│    977 │   │   │   │   logging.error(                                        │
│ ❱  978 │   │   │   │   │   "Media "                                          │
│    979 │   │   │   │   │   + config["host"]                                  │
│    980 │   │   │   │   │   + "/media/"                                       │
│    981 │   │   │   │   │   + str(media_id)                                   │
╰──────────────────────────────────────────────────────────────────────────────╯
TypeError: can only concatenate str (not "KeyError") to str
islandora@ip-172-17-0-36:/opt/islandora_workbench$

Here's the CSV I was trying to roll back. sample_set_error.csv

mjordan commented 2 months ago

Looks like it failed on the third node in the rollback file. There should be a 'rollback.csv' file in your input directory. Is the third entry in it the same as the first two entries?

dara2 commented 2 months ago

I can't find a rollback.csv - only a rollback.csv.preprocessed file, which I can't open.

dara2 commented 2 months ago

But I can confirm that the two nodes it did delete were the first two in the input CSV.

mjordan commented 2 months ago

It's a csv file, you can open it in a text editor.

dara2 commented 2 months ago

Ah, okay - thanks. First 6 rows are:

id,parent_id,title,field_weight,field_alternative_title,field_identifier,field_resource_type,field_model,field_creator,field_interviewer,field_interviewee,field_linked_agent,field_edtf_date_created,field_edtf_date,field_edtf_date_issued,field_date_text,field_place_published,field_table_of_contents,field_description_long,field_genre,field_physical_form,field_extent,field_rights_wlu,field_rights_statement,field_class,field_subject,field_geographic_subject,field_subjects_name,field_temporal_subject,field_handle,field_local_identifier,field_scholarship_type,field_department,field_former_dept_name,field_program,field_degree,field_embargo_period,field_contributing_institution,field_collection_id,field_collection_guide,field_physical_storage_location,field_volume,field_issue_no,field_lcc_classification,field_citation,field_restrictions,field_note,field_member_of,field_language,field_access_terms,field_display_hints,file,extracted_text,thumbnail,transcript,service_file
1,,Sample Collection,,,,Collection,Collection,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
2,1,"Oral History Interview with Robert C. Dyer, July 10, 1996",,,WLUcoll0239_b148_Dyer_1996,Collection,Compound Object,,"Warren, Mame (Mary Elizabeth)","Dyer, Robert Campbell",,1996-07-10,1996-07-10,,,,,Robert Dyer is a member of the Class of 1935 of Washington and Lee University.,Oral History,cassette tape,32 minutes; 51 minutes|12 pages,"In Copyright - Educational Use Permitted
This material is made available for use in research, teaching, and private study, pursuant to U.S. Copyright law. The user assumes full responsibility for any use of the materials, including but not limited to, infringement of copyright and publication rights of reproduced materials. Any materials used should be fully credited with the source. Permission for publication of this material, in part or in full, must be secured with the Head of Special Collections.",http://rightsstatements.org/vocab/InC-EDU/1.0/,Class of 1935,School Integration|Coeducation|Greek letter societies|Fancy Dress Ball|Mock Convention,Virginia--Lexington,corporate_body:Washington and Lee University,20th Century,http://hdl.handle.net/11021/34455,as_5211,,,,,,,Washington and Lee University,WLU Coll0239 - Mame Warren Collection,https://archivesspace.wlu.edu/repositories/5/resources/534,Coll 239 - Box 212,,,,"example, example",,,,English,,,,,,,
3,2,Cassette Side 1,,,WLUcoll0239_b148_Dyer_1996_1A,Audio,Sound,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,WLUcoll0239_b148_Dyer_1996_1A.wav,WLUcoll0239_b148_Dyer_1996_1A.txt,,,WLUcoll0239_b148_Dyer_1996_1A.mp3
4,2,Transcript,,,WLUcoll0239_b148_Dyer_1996_transcript,Text,Digital Document,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,PDFjs,WLUcoll0239_b148_Dyer_1996.pdf,,,,
5,1,Ring-Tum Phi,,,WLU_RTP,Collection,Newspaper,corporate_body:Washington and Lee University,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
dara2 commented 2 months ago

The third entry is a child of a compound; the compound parent is the second entry.