@@ -48,12 +48,15 @@ def forward_to_manager(self, request_type: 'sunfish.models.types.SunfishRequestT
4848 # get the parent path
4949 logger .debug (f"Checking managing agent for path: { path_to_check } " )
5050 agent = Agent .is_agent_managed (self .core , path_to_check )
51- print (f"managing agent is { agent } " )
5251 if agent :
5352 logger .debug (f"{ path } is managed by an agent, forwarding the request" )
54- obj_modified = self .xlateToAgentURIs (payload )
55- # extract restored name from payload
56- restored_path = payload ["@odata.id" ]
53+ # if no payload, cannot xlateToAgent
54+ if payload is not None :
55+ obj_modified = self .xlateToAgentURIs (payload )
56+ # extract restored name from payload
57+ restored_path = payload ["@odata.id" ]
58+ else :
59+ restored_path = path
5760 try :
5861 agent_response = agent .forward_request (request_type , restored_path , payload = payload )
5962 except AgentForwardingFailure as e :
@@ -119,13 +122,14 @@ def findNestedURIs(self, URI_to_match, URI_to_sub, obj, path_to_nested_URI):
119122 try :
120123 uri_alias_file = os .path .join (os .getcwd (), self .core .conf ["backend_conf" ]["fs_private" ], 'URI_aliases.json' )
121124 if os .path .exists (uri_alias_file ):
122- print (f"reading alias file { uri_alias_file } " )
125+ logging . debug (f"reading alias file { uri_alias_file } " )
123126 with open (uri_alias_file , 'r' ) as data_json :
124127 uri_aliasDB = json .load (data_json )
125128 data_json .close ()
126129 else :
127- print (f"alias file { uri_alias_file } not found" )
128- raise Exception
130+ logging .debug (f"alias file { uri_alias_file } not found" )
131+ #no alias file, so we are done, no modifications done
132+ return False
129133
130134 except :
131135 raise Exception
@@ -208,7 +212,7 @@ def findNestedURIs(self, URI_to_match, URI_to_sub, obj, path_to_nested_URI):
208212 data_json .close ()
209213 else :
210214 print (f"alias file { uri_alias_file } not found" )
211- raise Exception
215+ return False
212216
213217 except :
214218 raise Exception
0 commit comments