Skip to content

Commit

Permalink
Vast: Updating the ssh key adding to avoid duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
kristopolous committed Jan 7, 2025
1 parent 2663231 commit 5286660
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sky/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,12 @@ def setup_vast_authentication(config: Dict[str, Any]) -> Dict[str, Any]:
_, public_key_path = get_or_generate_keys()
with open(public_key_path, 'r', encoding='UTF-8') as pub_key_file:
public_key = pub_key_file.read().strip()
vast.vast().create_ssh_key(ssh_key=public_key)
current_key_list = vast.vast().show_ssh_keys()

# Only add an ssh key if it hasn't already been added
if not any(filter(lambda x: x['public_key'] == public_key, current_key_list)):
vast.vast().create_ssh_key(ssh_key=public_key)

config['auth']['ssh_public_key'] = PUBLIC_SSH_KEY_PATH
return configure_ssh_info(config)

Expand Down

0 comments on commit 5286660

Please sign in to comment.