Skip to content

Commit

Permalink
this?
Browse files Browse the repository at this point in the history
  • Loading branch information
dlwh committed Sep 7, 2024
1 parent f321131 commit 1e3c0cf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/levanter/infra/tpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,14 @@ def add_ssh_key(ssh_key_filename):
# have to make sure .ssh exists
os.makedirs(os.path.expanduser("~/.ssh"), exist_ok=True)
try:
key_hash = subprocess.check_output(["ssh-keygen", "-lf", ssh_key_filename]).decode("utf-8").split()[1]
existing_keys = subprocess.check_output(["ssh-add", "-l"]).decode("utf-8").split("\n")
key_hash = (
subprocess.check_output(["ssh-keygen", "-lf", ssh_key_filename], stderr=subprocess.STDOUT)
.decode("utf-8")
.split()[1]
)
existing_keys = (
subprocess.check_output(["ssh-add", "-l"], stderr=subprocess.STDOUT).decode("utf-8").split("\n")
)
for key in existing_keys:
if key_hash in key:
return
Expand Down

0 comments on commit 1e3c0cf

Please sign in to comment.