dayhoff-tools 1.7.0__py3-none-any.whl → 1.7.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dayhoff_tools/cli/engine_commands.py +49 -3
- {dayhoff_tools-1.7.0.dist-info → dayhoff_tools-1.7.1.dist-info}/METADATA +1 -1
- {dayhoff_tools-1.7.0.dist-info → dayhoff_tools-1.7.1.dist-info}/RECORD +5 -5
- {dayhoff_tools-1.7.0.dist-info → dayhoff_tools-1.7.1.dist-info}/WHEEL +0 -0
- {dayhoff_tools-1.7.0.dist-info → dayhoff_tools-1.7.1.dist-info}/entry_points.txt +0 -0
@@ -1,6 +1,7 @@
|
|
1
1
|
"""Engine and Studio management commands for DHT CLI."""
|
2
2
|
|
3
3
|
import json
|
4
|
+
import os
|
4
5
|
import re
|
5
6
|
import shutil
|
6
7
|
import subprocess
|
@@ -365,13 +366,58 @@ def resolve_engine(name_or_id: str, engines: List[Dict]) -> Dict:
|
|
365
366
|
|
366
367
|
|
367
368
|
def get_ssh_public_key() -> str:
|
368
|
-
"""Get the user's SSH public key.
|
369
|
+
"""Get the user's SSH public key.
|
370
|
+
|
371
|
+
Discovery order (container-friendly):
|
372
|
+
1) DHT_SSH_PUBLIC_KEY env var (direct key content)
|
373
|
+
2) DHT_SSH_PUBLIC_KEY_PATH env var (path to a .pub file)
|
374
|
+
3) ssh-agent via `ssh-add -L` (requires SSH_AUTH_SOCK)
|
375
|
+
4) Conventional files: ~/.ssh/id_ed25519.pub, ~/.ssh/id_rsa.pub
|
376
|
+
|
377
|
+
Raises:
|
378
|
+
FileNotFoundError: If no public key can be discovered.
|
379
|
+
"""
|
380
|
+
# 1) Direct env var content
|
381
|
+
env_key = os.environ.get("DHT_SSH_PUBLIC_KEY")
|
382
|
+
if env_key and env_key.strip():
|
383
|
+
return env_key.strip()
|
384
|
+
|
385
|
+
# 2) Env var path
|
386
|
+
env_path = os.environ.get("DHT_SSH_PUBLIC_KEY_PATH")
|
387
|
+
if env_path:
|
388
|
+
p = Path(env_path).expanduser()
|
389
|
+
if p.is_file():
|
390
|
+
try:
|
391
|
+
return p.read_text().strip()
|
392
|
+
except Exception:
|
393
|
+
pass
|
394
|
+
|
395
|
+
# 3) Agent lookup (ssh-add -L)
|
396
|
+
try:
|
397
|
+
if shutil.which("ssh-add") is not None:
|
398
|
+
proc = subprocess.run(["ssh-add", "-L"], capture_output=True, text=True)
|
399
|
+
if proc.returncode == 0 and proc.stdout:
|
400
|
+
keys = [line.strip() for line in proc.stdout.splitlines() if line.strip()]
|
401
|
+
# Prefer ed25519, then rsa
|
402
|
+
for pref in ("ssh-ed25519", "ssh-rsa", "ecdsa-sha2-nistp256"):
|
403
|
+
for k in keys:
|
404
|
+
if k.startswith(pref + " "):
|
405
|
+
return k
|
406
|
+
# Fallback to first key if types not matched
|
407
|
+
if keys:
|
408
|
+
return keys[0]
|
409
|
+
except Exception:
|
410
|
+
pass
|
411
|
+
|
412
|
+
# 4) Conventional files
|
369
413
|
home = Path.home()
|
370
414
|
key_paths = [home / ".ssh" / "id_ed25519.pub", home / ".ssh" / "id_rsa.pub"]
|
371
|
-
|
372
415
|
for key_path in key_paths:
|
373
416
|
if key_path.is_file():
|
374
|
-
|
417
|
+
try:
|
418
|
+
return key_path.read_text().strip()
|
419
|
+
except Exception:
|
420
|
+
continue
|
375
421
|
|
376
422
|
raise FileNotFoundError(
|
377
423
|
"No SSH public key found. Please create one with 'ssh-keygen' first."
|
@@ -3,7 +3,7 @@ dayhoff_tools/chemistry/standardizer.py,sha256=uMn7VwHnx02nc404eO6fRuS4rsl4dvSPf
|
|
3
3
|
dayhoff_tools/chemistry/utils.py,sha256=jt-7JgF-GeeVC421acX-bobKbLU_X94KNOW24p_P-_M,2257
|
4
4
|
dayhoff_tools/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
dayhoff_tools/cli/cloud_commands.py,sha256=33qcWLmq-FwEXMdL3F0OHm-5Stlh2r65CldyEZgQ1no,40904
|
6
|
-
dayhoff_tools/cli/engine_commands.py,sha256=
|
6
|
+
dayhoff_tools/cli/engine_commands.py,sha256=_NQI9x4VKtAC9vTDdA4NGrILf2kb005t3Kw0aZ5oroE,96485
|
7
7
|
dayhoff_tools/cli/main.py,sha256=tRN7WCBHg6uyNp6rA54pKTCoVmBntta2i0Yas3bUpZ4,4853
|
8
8
|
dayhoff_tools/cli/swarm_commands.py,sha256=5EyKj8yietvT5lfoz8Zx0iQvVaNgc3SJX1z2zQR6o6M,5614
|
9
9
|
dayhoff_tools/cli/utility_commands.py,sha256=FRZTPrjsG_qmIIqoNxd1Q1vVkS_5w8aY33IrVYVNCLg,18131
|
@@ -27,7 +27,7 @@ dayhoff_tools/intake/uniprot.py,sha256=BZYJQF63OtPcBBnQ7_P9gulxzJtqyorgyuDiPeOJq
|
|
27
27
|
dayhoff_tools/logs.py,sha256=DKdeP0k0kliRcilwvX0mUB2eipO5BdWUeHwh-VnsICs,838
|
28
28
|
dayhoff_tools/sqlite.py,sha256=jV55ikF8VpTfeQqqlHSbY8OgfyfHj8zgHNpZjBLos_E,18672
|
29
29
|
dayhoff_tools/warehouse.py,sha256=heaYc64qplgN3_1WVPFmqj53goStioWwY5NqlWc4c0s,24453
|
30
|
-
dayhoff_tools-1.7.
|
31
|
-
dayhoff_tools-1.7.
|
32
|
-
dayhoff_tools-1.7.
|
33
|
-
dayhoff_tools-1.7.
|
30
|
+
dayhoff_tools-1.7.1.dist-info/METADATA,sha256=SfgSoCKU9G3NVk4aeQprKBvjn8-bHUXPy5jT2EIS1sA,2914
|
31
|
+
dayhoff_tools-1.7.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
32
|
+
dayhoff_tools-1.7.1.dist-info/entry_points.txt,sha256=iAf4jteNqW3cJm6CO6czLxjW3vxYKsyGLZ8WGmxamSc,49
|
33
|
+
dayhoff_tools-1.7.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|