@@ -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