File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
testflows/github/hetzner/runners Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -82,13 +82,10 @@ def switch_type(v):
8282 raise ArgumentTypeError (f"invalid value { v } " )
8383
8484
85- def path_type (v , check_exists = True ):
85+ def path_type (v ):
8686 """Path argument type."""
8787 try :
8888 v = os .path .abspath (os .path .expanduser (v ))
89- if check_exists :
90- if not os .path .exists (v ):
91- raise FileNotFoundError (f"path not found '{ v } '" )
9289 except Exception as e :
9390 raise ArgumentTypeError (str (e ))
9491 return v
Original file line number Diff line number Diff line change @@ -66,6 +66,10 @@ class StartupScriptError(Exception):
6666 pass
6767
6868
69+ class ScriptsError (Exception ):
70+ pass
71+
72+
6973class ServerTypeError (Exception ):
7074 pass
7175
@@ -270,7 +274,7 @@ def parse_config(filename: str):
270274
271275 if doc .get ("ssh_key" ) is not None :
272276 assert isinstance (doc ["ssh_key" ], str ), "config.ssh_key: is not a string"
273- doc ["ssh_key" ] = path (doc ["ssh_key" ], check_exists = False )
277+ doc ["ssh_key" ] = path (doc ["ssh_key" ])
274278
275279 if doc .get ("additional_ssh_keys" ) is not None :
276280 assert isinstance (
@@ -777,6 +781,13 @@ def check_prices(client: Client):
777781 }
778782
779783
784+ def check_scripts (scripts : str ):
785+ """Check if scripts directory exists."""
786+ if not os .path .exists (scripts ):
787+ raise ScriptsError (f"invalid scripts directory '{ scripts } '" )
788+ return scripts
789+
790+
780791def check_setup_script (script : str ):
781792 """Check if setup script is valid."""
782793 if not os .path .exists (script ):
You can’t perform that action at this time.
0 commit comments