Skip to content

Commit e4e7b51

Browse files
committed
change parameter ipuuid to path for ETA->EPP upload function
1 parent 3b569cc commit e4e7b51

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

ESSArch_TA/esscore/rest/uploadchunkedrestclient.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __init__(self, requests_session, rest_endpoint, progress_reporter=default_re
4747
self.rest_endpoint = rest_endpoint
4848
self.progress_reporter = progress_reporter
4949

50-
def upload(self, local_file_path, chunk_size=1048576*10, ipuuid = None):
50+
def upload(self, local_file_path, chunk_size=1048576*10, path = None):
5151
"""
5252
Add log message
5353
@type local_file_path: string
@@ -104,7 +104,7 @@ def upload(self, local_file_path, chunk_size=1048576*10, ipuuid = None):
104104
m = MultipartEncoder(
105105
fields={'upload_id': upload_id,
106106
'md5': hash.hexdigest(),
107-
'ipuuid': ipuuid,
107+
'path': path,
108108
}
109109
)
110110
headers={'Content-Type': m.content_type}

ESSArch_TA/lib/app_tools.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,12 +1011,6 @@ def transferIP( agent, contextdata ):
10111011
else :
10121012
ip_uuid = context["ip_uuid"]
10131013

1014-
# get or create aic_uuid
1015-
try :
1016-
aic_uuid = context["aic_uuid"]
1017-
except:
1018-
aic_uuid = str(uuid.uuid4())
1019-
10201014
# set flag to transfer local or remote
10211015
remote_server_string = Parameter.objects.get(entity='preservation_organization_receiver').value
10221016
remote_server = remote_server_string.split(',')
@@ -1028,6 +1022,13 @@ def transferIP( agent, contextdata ):
10281022
if site_profile == 'SE' or site_profile == 'NO':
10291023
src_ipfilepath = os.path.join(contextdata["iplocation"], '%s.tar' % ip_uuid)
10301024
src_logfilepath = os.path.join(contextdata["iplocation"], ip_logfile)
1025+
1026+
# get or create aic_uuid
1027+
try :
1028+
ip_metadata = getLogMetadata(src_logfilepath)
1029+
aic_uuid = ip_metadata['aic_object']
1030+
except:
1031+
aic_uuid = str(uuid.uuid4())
10311032

10321033
if not remote_flag:
10331034
# create AIC_UUID directory
@@ -1052,18 +1053,19 @@ def transferIP( agent, contextdata ):
10521053
dst_logfilename = os.path.join(ip_rootpath, ip_logfile)
10531054
shutil.copy(src_logfilepath, dst_logfilename)
10541055
else:
1055-
print 'upload ip_uuid: %s' % ip_uuid
1056+
path = os.path.join(aic_uuid, ip_uuid)
1057+
print 'upload path: %s' % path
10561058
# init uploadclient
10571059
base_url, ruser, rpass = remote_server
10581060
upload_rest_endpoint = urljoin(base_url, '/api/create_gatearea_upload')
10591061
requests_session = _initialize_requests_session(ruser, rpass, cert_verify=False, disable_warnings=True)
10601062
uploadclient = UploadChunkedRestClient(requests_session, upload_rest_endpoint)
10611063
# upload specification file
1062-
uploadclient.upload(pspec_filepath, ipuuid=ip_uuid)
1064+
uploadclient.upload(pspec_filepath, path=path)
10631065
# upload IP file
1064-
uploadclient.upload(src_ipfilepath, ipuuid=ip_uuid)
1066+
uploadclient.upload(src_ipfilepath, path=path)
10651067
# upload log file
1066-
uploadclient.upload(src_logfilepath, ipuuid=ip_uuid)
1068+
uploadclient.upload(src_logfilepath, path=path)
10671069

10681070
#eventType = 20000 # type of event
10691071
#eventDetail = 'Created log circular' # event detail

0 commit comments

Comments
 (0)