File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed
custom-domain/dstack-ingress/scripts Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -186,13 +186,23 @@ def _ensure_certbot_in_env(self) -> None:
186186 def _get_certbot_command (self ) -> List [str ]:
187187 """Get the correct certbot command that uses the same Python environment."""
188188 import sys
189+ import os
189190
190- # Always use Python module execution to ensure same environment
191- # This guarantees that certbot runs in the same Python environment
192- # where we installed the plugins
193- cmd = [sys .executable , "-m" , "certbot" ]
194- print (f"Using certbot via Python module: { ' ' .join (cmd )} " )
195- return cmd
191+ # Always use certbot from the same Python environment
192+ python_dir = os .path .dirname (sys .executable )
193+ venv_certbot = os .path .join (python_dir , "certbot" )
194+
195+ if os .path .exists (venv_certbot ):
196+ cmd = [venv_certbot ]
197+ print (f"Using certbot from virtual environment: { venv_certbot } " )
198+ return cmd
199+
200+ # If certbot doesn't exist in venv, this is an error condition
201+ raise RuntimeError (
202+ f"Certbot not found in virtual environment: { venv_certbot } . "
203+ f"This indicates the environment setup failed. "
204+ f"Python executable: { sys .executable } "
205+ )
196206
197207 def _debug_plugin_registration (self ) -> None :
198208 """Debug why plugin is not being registered by certbot."""
You can’t perform that action at this time.
0 commit comments