@@ -76,7 +76,7 @@ async def _execute_hook(
7676 context : HookContext ,
7777 log_source : LogSource ,
7878 socket_path : str | None = None ,
79- ) -> bool :
79+ ):
8080 """Execute a single hook command.
8181
8282 Args:
@@ -89,7 +89,7 @@ async def _execute_hook(
8989 command = hook_config .script
9090 if not command or not command .strip ():
9191 logger .debug ("Hook command is empty, skipping" )
92- return True
92+ return
9393
9494 logger .info ("Executing hook: %s" , command .strip ().split ("\n " )[0 ][:100 ])
9595
@@ -129,7 +129,7 @@ async def _execute_hook_process(
129129 log_source : LogSource ,
130130 hook_env : dict ,
131131 logging_session : Session ,
132- ) -> bool :
132+ ):
133133 """Execute the hook process with the given environment and logging session."""
134134 command = hook_config .script
135135 timeout = hook_config .timeout
@@ -168,22 +168,22 @@ async def read_output():
168168 # Check if exit code matches expected
169169 if process .returncode == expected_exit_code :
170170 logger .info ("Hook executed successfully with exit code %d" , process .returncode )
171- return True
171+ return
172172 else :
173173 # Exit code mismatch - handle according to on_failure setting
174174 error_msg = f"Hook failed: expected exit code { expected_exit_code } , got { process .returncode } "
175175
176176 if on_failure == "pass" :
177177 logger .info ("%s (on_failure=pass, continuing)" , error_msg )
178- return True
178+ return
179179 elif on_failure == "warn" :
180180 logger .warning ("%s (on_failure=warn, continuing)" , error_msg )
181- return True
181+ return
182182 else : # on_failure == "block"
183183 logger .error ("%s (on_failure=block, raising exception)" , error_msg )
184184 raise HookExecutionError (error_msg )
185185
186- except asyncio .TimeoutError :
186+ except asyncio .TimeoutError as e :
187187 error_msg = f"Hook timed out after { timeout } seconds"
188188 logger .error (error_msg )
189189 try :
@@ -196,12 +196,12 @@ async def read_output():
196196 # Handle timeout according to on_failure setting
197197 if on_failure == "pass" :
198198 logger .info ("%s (on_failure=pass, continuing)" , error_msg )
199- return True
199+ return
200200 elif on_failure == "warn" :
201201 logger .warning ("%s (on_failure=warn, continuing)" , error_msg )
202- return True
202+ return
203203 else : # on_failure == "block"
204- raise HookExecutionError (error_msg )
204+ raise HookExecutionError (error_msg ) from e
205205
206206 except HookExecutionError :
207207 # Re-raise HookExecutionError to propagate to exporter
@@ -213,14 +213,14 @@ async def read_output():
213213 # Handle exception according to on_failure setting
214214 if on_failure == "pass" :
215215 logger .info ("%s (on_failure=pass, continuing)" , error_msg )
216- return True
216+ return
217217 elif on_failure == "warn" :
218218 logger .warning ("%s (on_failure=warn, continuing)" , error_msg )
219- return True
219+ return
220220 else : # on_failure == "block"
221221 raise HookExecutionError (error_msg ) from e
222222
223- async def execute_before_lease_hook (self , context : HookContext , socket_path : str | None = None ) -> bool :
223+ async def execute_before_lease_hook (self , context : HookContext , socket_path : str | None = None ):
224224 """Execute the before-lease hook.
225225
226226 Args:
@@ -232,17 +232,17 @@ async def execute_before_lease_hook(self, context: HookContext, socket_path: str
232232 """
233233 if not self .config .before_lease :
234234 logger .debug ("No before-lease hook configured" )
235- return True
235+ return
236236
237237 logger .info ("Executing before-lease hook for lease %s" , context .lease_name )
238- return await self ._execute_hook (
238+ await self ._execute_hook (
239239 self .config .before_lease ,
240240 context ,
241241 LogSource .BEFORE_LEASE_HOOK ,
242242 socket_path ,
243243 )
244244
245- async def execute_after_lease_hook (self , context : HookContext , socket_path : str | None = None ) -> bool :
245+ async def execute_after_lease_hook (self , context : HookContext , socket_path : str | None = None ):
246246 """Execute the after-lease hook.
247247
248248 Args:
@@ -254,10 +254,10 @@ async def execute_after_lease_hook(self, context: HookContext, socket_path: str
254254 """
255255 if not self .config .after_lease :
256256 logger .debug ("No after-lease hook configured" )
257- return True
257+ return
258258
259259 logger .info ("Executing after-lease hook for lease %s" , context .lease_name )
260- return await self ._execute_hook (
260+ await self ._execute_hook (
261261 self .config .after_lease ,
262262 context ,
263263 LogSource .AFTER_LEASE_HOOK ,
0 commit comments