@@ -375,19 +375,21 @@ def _process_message(self, body):
375375 if body .get ('notifies' ):
376376 emailaddrlist = body .get ('notifies' )
377377 logger .debug (emailaddrlist )
378- host = self .clowder_url if self .clowder_url is not None else body .get ('host' , '' )
379- if host == '' :
378+ # source_host is original from the message, host is remapped to CLOWDER_URL if given
379+ source_host = body .get ('host' , '' )
380+ host = self .clowder_url if self .clowder_url is not None else source_host
381+ if host == '' or source_host == '' :
380382 return
381- elif not host .endswith ('/' ):
382- host += '/'
383+ if not source_host .endswith ('/' ): source_host += '/'
384+ if not host . endswith ( '/' ): host += '/'
383385 secret_key = body .get ('secretKey' , '' )
384386 retry_count = 0 if 'retry_count' not in body else body ['retry_count' ]
385387 resource = self ._build_resource (body , host , secret_key )
386388 if not resource :
387389 return
388390
389391 # register extractor
390- url = "%sapi/extractors" % host
392+ url = "%sapi/extractors" % source_host
391393 if url not in Connector .registered_clowder :
392394 Connector .registered_clowder .append (url )
393395 self .register_extractor ("%s?key=%s" % (url , secret_key ))
@@ -400,7 +402,7 @@ def _process_message(self, body):
400402 try :
401403 check_result = pyclowder .utils .CheckMessage .download
402404 if self .check_message :
403- check_result = self .check_message (self , host , secret_key , resource , body )
405+ check_result = self .check_message (self , source_host , secret_key , resource , body )
404406 if check_result != pyclowder .utils .CheckMessage .ignore :
405407 if self .process_message :
406408
@@ -420,10 +422,10 @@ def _process_message(self, body):
420422 found_local = True
421423 resource ['local_paths' ] = [file_path ]
422424
423- self .process_message (self , host , secret_key , resource , body )
425+ self .process_message (self , source_host , secret_key , resource , body )
424426
425- clowderurl = "%sfiles/%s" % (host , body .get ('id' , '' ))
426- # notificatino of extraction job is done by email.
427+ clowderurl = "%sfiles/%s" % (source_host , body .get ('id' , '' ))
428+ # notification of extraction job is done by email.
427429 self .email (emailaddrlist , clowderurl )
428430 finally :
429431 if file_path is not None and not found_local :
@@ -440,8 +442,8 @@ def _process_message(self, body):
440442 (file_paths , tmp_files , tmp_dirs ) = self ._prepare_dataset (host , secret_key , resource )
441443 resource ['local_paths' ] = file_paths
442444
443- self .process_message (self , host , secret_key , resource , body )
444- clowderurl = "%sdatasets/%s" % (host , body .get ('datasetId' , '' ))
445+ self .process_message (self , source_host , secret_key , resource , body )
446+ clowderurl = "%sdatasets/%s" % (source_host , body .get ('datasetId' , '' ))
445447 # notificatino of extraction job is done by email.
446448 self .email (emailaddrlist , clowderurl )
447449 finally :
0 commit comments