Skip to content

Commit

Permalink
Merge pull request #273 from RockefellerArchiveCenter/deploy-fix
Browse files Browse the repository at this point in the history
Fixes bugs
  • Loading branch information
dboutmybizness committed Nov 5, 2018
2 parents 3889ddd + 03c7508 commit 2c802f1
Show file tree
Hide file tree
Showing 17 changed files with 353 additions and 6 deletions.
Binary file modified aurora/bag_transfer/accession/views.py
Binary file not shown.
9 changes: 4 additions & 5 deletions aurora/bag_transfer/lib/bag_checker.py
Expand Up @@ -64,16 +64,16 @@ def _is_generic_bag(self):
def _is_rac_bag(self):
"""Assumes a valid bag/bag info; returns true if passes rac profile"""

if not 'BagIt_Profile_Identifier' in self.bag_info_data:
if 'BagIt_Profile_Identifier' not in self.bag_info_data:
self.bag_exception = 'No BagIt Profile to validate against'
return False
else:

try:
profile = bagit_profile.Profile(self.bag_info_data['BagIt_Profile_Identifier'])

except Exception as e:
self.bag_exception = e
except BaseException:
self.bag_exception = "Cannot retrieve BagIt Profile from URL {}".format(self.bag_info_data['BagIt_Profile_Identifier'])
return False
else:

# RE IMPLEMENTING validate() SINCE VALIDATION MESSAGES ARE PRINTED
Expand All @@ -83,7 +83,6 @@ def _is_rac_bag(self):
try:
profile.validate_bag_info(self.bag)
except Exception as e:
print e
self.bag_exception = "Error in bag-info.txt: {}".format(e.value)
return False
try:
Expand Down
1 change: 1 addition & 0 deletions aurora/bag_transfer/lib/cron.py
Expand Up @@ -88,6 +88,7 @@ def do(self):
# Move bag to storage
# Should bags be stored in org directories for security purposes?
FH.move_file_or_dir('/data/tmp/{}'.format(new_arc.bag_it_name), '{}{}'.format(settings.STORAGE_ROOT_DIR, new_arc.machine_file_identifier))
FH.remove_file_or_dir(new_arc.machine_file_path)
new_arc.machine_file_path = '{}{}'.format(settings.STORAGE_ROOT_DIR, new_arc.machine_file_identifier)
else:
new_arc.process_status = 30
Expand Down
Expand Up @@ -4,7 +4,6 @@
<tr>
<th>Basis</th>
<th>Rights Notes</th>
<th></th>
</tr>
</thead>
<tbody>
Expand Down
1 change: 1 addition & 0 deletions aurora/bag_transfer/test/setup.py
Expand Up @@ -26,6 +26,7 @@
('missing_payload_directory', 'GBERR', True),
('missing_payload_manifest', 'GBERR', True),

('invalid_bagit_profile_url', 'RBERR', True),
('missing_description', 'RBERR', True),
('missing_record_type', 'RBERR', True),
('missing_source_organization', 'RBERR', True),
Expand Down
15 changes: 15 additions & 0 deletions sample_bags/invalid_bagit_profile_url/bag-info.txt
@@ -0,0 +1,15 @@
Bag-Software-Agent: bagit.py <http://github.com/libraryofcongress/bagit-python>
BagIt-Profile-Identifier: http://example.org/profile.json
Bagging-Date: 2017-11-04T14:40:17.118401
Date-End: 2002-06-22
Date-Start: 2000-05-14
External-Identifier: records-2017-11-04T14:40:17.118401
Internal-Sender-Description: Grant awarded to the Village Green Preservation Society for the purpose of "preserving the old ways from being abused, protecting the new ways for me and for you"
Language: eng
Payload-Oxum: 435255.8
Record-Creators: Custard Pie Appreciation Consortium
Record-Creators: Desperate Dan Appreciation Society
Record-Type: grant records
Restrictions: Records open only to Mrs. Mopp and good old Mother Riley
Source-Organization: Test Organization
Title: Grant to the Village Green Preservation Society
2 changes: 2 additions & 0 deletions sample_bags/invalid_bagit_profile_url/bagit.txt
@@ -0,0 +1,2 @@
BagIt-Version: 0.97
Tag-File-Character-Encoding: UTF-8
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

317 changes: 317 additions & 0 deletions sample_bags/invalid_bagit_profile_url/data/metadata.json
@@ -0,0 +1,317 @@
[
{
"_id": "5992098ae5be0ee2b3a53230",
"index": 0,
"guid": "42038759-10f6-4d07-80bd-d22a3d15c2a7",
"isActive": false,
"balance": "$2,972.29",
"picture": "http://placehold.it/32x32",
"age": 40,
"eyeColor": "blue",
"name": "Ofelia Cantrell",
"gender": "female",
"company": "REMOTION",
"email": "ofeliacantrell@remotion.com",
"phone": "+1 (933) 409-2769",
"address": "703 Perry Terrace, Yonah, Ohio, 2288",
"about": "Et do amet ex do quis duis. Esse cillum dolor minim qui irure ad ut. Do adipisicing sint esse sint culpa est minim commodo reprehenderit pariatur veniam quis consectetur qui. Cupidatat veniam aute laboris deserunt sint aliqua non sit non. Non minim voluptate velit dolor quis consequat exercitation. Sint et ea magna ex incididunt ea laborum.\r\n",
"registered": "2015-06-06T02:44:14 +04:00",
"latitude": -15.53943,
"longitude": -161.829515,
"tags": [
"duis",
"reprehenderit",
"tempor",
"exercitation",
"fugiat",
"ex",
"aliquip"
],
"friends": [
{
"id": 0,
"name": "Moran Donovan"
},
{
"id": 1,
"name": "Cross Leonard"
},
{
"id": 2,
"name": "Young Macdonald"
}
],
"greeting": "Hello, Ofelia Cantrell! You have 2 unread messages.",
"favoriteFruit": "banana"
},
{
"_id": "5992098a2d0e698c435ef3c4",
"index": 1,
"guid": "1602e45f-9ed8-4e8c-a464-cc921a8f5687",
"isActive": true,
"balance": "$1,819.74",
"picture": "http://placehold.it/32x32",
"age": 36,
"eyeColor": "green",
"name": "Payne Carter",
"gender": "male",
"company": "SPRINGBEE",
"email": "paynecarter@springbee.com",
"phone": "+1 (821) 446-3230",
"address": "649 Bush Street, Edgar, Missouri, 2760",
"about": "Laborum culpa dolor id quis incididunt mollit veniam. Incididunt consectetur tempor occaecat eiusmod sunt aute amet aliqua deserunt do Lorem aliquip in. Nostrud tempor irure eu ex sint magna cupidatat consequat quis pariatur elit proident. Reprehenderit consequat qui incididunt laboris esse esse incididunt quis culpa nisi. Aliqua aliqua anim aliquip irure occaecat mollit mollit nostrud ut sit qui. Amet enim ullamco qui mollit nisi irure labore ad. Velit enim aliqua laborum eu eu minim id enim deserunt.\r\n",
"registered": "2014-09-04T03:38:13 +04:00",
"latitude": 48.091037,
"longitude": -178.775433,
"tags": [
"excepteur",
"qui",
"magna",
"exercitation",
"sit",
"labore",
"laboris"
],
"friends": [
{
"id": 0,
"name": "Willa Moon"
},
{
"id": 1,
"name": "Jodie Briggs"
},
{
"id": 2,
"name": "Katina Ramirez"
}
],
"greeting": "Hello, Payne Carter! You have 10 unread messages.",
"favoriteFruit": "strawberry"
},
{
"_id": "5992098ad752f1c7ae3020a7",
"index": 2,
"guid": "051ecc3d-3e33-45ae-93c1-c1f48c892f87",
"isActive": false,
"balance": "$1,895.69",
"picture": "http://placehold.it/32x32",
"age": 28,
"eyeColor": "brown",
"name": "Kristi Young",
"gender": "female",
"company": "DATACATOR",
"email": "kristiyoung@datacator.com",
"phone": "+1 (991) 418-3593",
"address": "822 Reeve Place, Swartzville, Iowa, 1295",
"about": "Amet do in laboris commodo ut aute ullamco voluptate mollit proident labore qui anim in. Ipsum occaecat incididunt sit culpa eu et ad dolore proident et tempor nostrud minim. Deserunt reprehenderit adipisicing laborum velit labore eiusmod amet consectetur aute do amet non labore exercitation.\r\n",
"registered": "2014-02-22T11:35:14 +05:00",
"latitude": -33.068243,
"longitude": -135.989542,
"tags": [
"in",
"elit",
"consequat",
"incididunt",
"magna",
"id",
"aliqua"
],
"friends": [
{
"id": 0,
"name": "Mclean Merrill"
},
{
"id": 1,
"name": "Donna Moss"
},
{
"id": 2,
"name": "Eva Donaldson"
}
],
"greeting": "Hello, Kristi Young! You have 4 unread messages.",
"favoriteFruit": "strawberry"
},
{
"_id": "5992098a3c3d2bd8f4e680b5",
"index": 3,
"guid": "434e2f6c-8896-4267-95c8-4443da518937",
"isActive": true,
"balance": "$1,226.19",
"picture": "http://placehold.it/32x32",
"age": 25,
"eyeColor": "green",
"name": "Cassie Wells",
"gender": "female",
"company": "DRAGBOT",
"email": "cassiewells@dragbot.com",
"phone": "+1 (962) 455-2900",
"address": "467 Conselyea Street, Fresno, Utah, 5198",
"about": "Nisi enim irure velit cillum et ut eu. Ullamco esse cupidatat est proident amet anim voluptate. Eiusmod aute occaecat aliquip laboris et. Elit velit minim nostrud consectetur cillum ipsum. Nostrud enim nisi proident excepteur ex aliquip exercitation. Dolore cillum laborum ut cupidatat officia exercitation aliquip eiusmod eiusmod cupidatat elit mollit esse. Aute excepteur cupidatat do aliqua magna commodo magna esse eiusmod sint et cupidatat labore elit.\r\n",
"registered": "2017-02-15T08:33:56 +05:00",
"latitude": 15.310112,
"longitude": -18.42037,
"tags": [
"commodo",
"aliqua",
"aute",
"tempor",
"enim",
"excepteur",
"labore"
],
"friends": [
{
"id": 0,
"name": "Loretta Gates"
},
{
"id": 1,
"name": "Moreno Mathis"
},
{
"id": 2,
"name": "Lisa Sloan"
}
],
"greeting": "Hello, Cassie Wells! You have 1 unread messages.",
"favoriteFruit": "strawberry"
},
{
"_id": "5992098ac51d569909f3f924",
"index": 4,
"guid": "c55f4203-3136-427e-a9b1-cd4f447a7e66",
"isActive": true,
"balance": "$2,813.15",
"picture": "http://placehold.it/32x32",
"age": 23,
"eyeColor": "blue",
"name": "Leigh Levy",
"gender": "female",
"company": "IMAGINART",
"email": "leighlevy@imaginart.com",
"phone": "+1 (976) 465-3476",
"address": "390 Furman Street, Albrightsville, Wisconsin, 2324",
"about": "Excepteur commodo minim veniam aute et dolore ea voluptate magna eu laboris. Laboris cupidatat est mollit proident consectetur eiusmod officia aute aliqua culpa. In fugiat qui enim sunt.\r\n",
"registered": "2014-05-03T01:12:53 +04:00",
"latitude": 35.087356,
"longitude": -5.142767,
"tags": [
"mollit",
"duis",
"veniam",
"laboris",
"magna",
"et",
"exercitation"
],
"friends": [
{
"id": 0,
"name": "Middleton Walker"
},
{
"id": 1,
"name": "Fitzgerald Dickerson"
},
{
"id": 2,
"name": "Teresa Cherry"
}
],
"greeting": "Hello, Leigh Levy! You have 6 unread messages.",
"favoriteFruit": "strawberry"
},
{
"_id": "5992098a01c1b5dc6b527746",
"index": 5,
"guid": "21cb7015-229a-48d2-89bd-ed664c493001",
"isActive": false,
"balance": "$2,106.23",
"picture": "http://placehold.it/32x32",
"age": 31,
"eyeColor": "brown",
"name": "Santiago Valencia",
"gender": "male",
"company": "TERRAGO",
"email": "santiagovalencia@terrago.com",
"phone": "+1 (887) 540-3439",
"address": "241 Quentin Road, Strong, Nevada, 9629",
"about": "Qui elit do veniam tempor do nisi in tempor anim magna. Laborum ex sint do elit reprehenderit tempor. Mollit labore ut amet in anim. Proident cillum sint elit aute reprehenderit exercitation duis fugiat ad velit pariatur non excepteur. Minim consequat anim dolore proident.\r\n",
"registered": "2015-01-27T04:21:17 +05:00",
"latitude": 31.602384,
"longitude": 78.941588,
"tags": [
"eu",
"voluptate",
"eu",
"ad",
"excepteur",
"sit",
"sint"
],
"friends": [
{
"id": 0,
"name": "Ellen Mccarty"
},
{
"id": 1,
"name": "Deloris French"
},
{
"id": 2,
"name": "Brandie Porter"
}
],
"greeting": "Hello, Santiago Valencia! You have 4 unread messages.",
"favoriteFruit": "banana"
},
{
"_id": "5992098ad8b6931921cd3539",
"index": 6,
"guid": "42e83426-f488-4077-9d8a-0df690e26d77",
"isActive": false,
"balance": "$3,769.50",
"picture": "http://placehold.it/32x32",
"age": 28,
"eyeColor": "brown",
"name": "Ursula Lester",
"gender": "female",
"company": "LIQUICOM",
"email": "ursulalester@liquicom.com",
"phone": "+1 (916) 549-2548",
"address": "548 Coleman Street, Elbert, Vermont, 1941",
"about": "Lorem qui pariatur officia proident ullamco occaecat velit aute ex adipisicing velit commodo proident dolor. Sit consectetur culpa commodo aliquip commodo reprehenderit labore ea dolore ex enim enim. Laboris proident fugiat ea enim sunt eiusmod enim sint non enim proident aliqua deserunt. Eiusmod qui do eiusmod irure ad. Elit magna enim in excepteur occaecat esse excepteur commodo ut. Ea aute veniam qui ea adipisicing quis id consequat esse laboris ea consectetur amet minim.\r\n",
"registered": "2017-06-24T10:28:26 +04:00",
"latitude": -72.032682,
"longitude": -58.19158,
"tags": [
"nulla",
"nostrud",
"anim",
"exercitation",
"ullamco",
"ipsum",
"cupidatat"
],
"friends": [
{
"id": 0,
"name": "Maddox Weeks"
},
{
"id": 1,
"name": "Paul Peterson"
},
{
"id": 2,
"name": "Powers Quinn"
}
],
"greeting": "Hello, Ursula Lester! You have 6 unread messages.",
"favoriteFruit": "apple"
}
]
Binary file not shown.
Binary file not shown.
8 changes: 8 additions & 0 deletions sample_bags/invalid_bagit_profile_url/manifest-md5.txt
@@ -0,0 +1,8 @@
194577a7e20bdcc7afbb718f502c134c data/.DS_Store
d52d759e406e40739203b494cebb0e71 data/Lorem ipsum dolor sit amet.docx
6b78065070118d9657b7dface5bf8065 data/Lorem ipsum.odt
6b417a5079c8dab04cbda2c4d0b4f40f data/consectetur adipiscing elit.pdf
22146c62a885ca2ff813e1de16bdd86a data/consectetur adipiscing elit.rtf
805541eca3750659ba97aacbb4d8a1db data/metadata.json
20e136ecba3d349c5ea2ea75d1a2a547 data/more_data.xlsx
2144cb2ec4ebbc8cd508d8cf02c04bd2 data/sample_data.xlsx

0 comments on commit 2c802f1

Please sign in to comment.