Skip to content

Commit 50090d9

Browse files
author
Vitaliy Zakaznikov
committed
Adding check for scripts folder but not using yet.
1 parent 8310607 commit 50090d9

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

testflows/github/hetzner/runners/args.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff 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

testflows/github/hetzner/runners/config/config.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ class StartupScriptError(Exception):
6666
pass
6767

6868

69+
class ScriptsError(Exception):
70+
pass
71+
72+
6973
class 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+
780791
def check_setup_script(script: str):
781792
"""Check if setup script is valid."""
782793
if not os.path.exists(script):

0 commit comments

Comments
 (0)