Skip to content

Commit 8dab9e2

Browse files
committed
Allow for rsa and ed25519 keys by default for install VM
1 parent 38e7a0c commit 8dab9e2

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

‎tests/install_vm.py‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,14 @@ def handle_ssh_pubkey(data):
208208
data.ssh_pubkey_used = bool(data.ssh_pubkey)
209209
if not data.ssh_pubkey:
210210
home_dir = os.path.expanduser('~')
211-
user_default_key = f'{home_dir}/.ssh/id_rsa.pub'
212-
if os.path.isfile(user_default_key):
213-
data.ssh_pubkey = user_default_key
214-
with open(data.ssh_pubkey) as f:
215-
data.pub_key_content = f.readline().rstrip()
211+
key_types = ['ed25519', 'rsa',]
212+
for key_type in key_types:
213+
user_default_key = f'{home_dir}/.ssh/id_{key_type}.pub'
214+
if os.path.isfile(user_default_key):
215+
data.ssh_pubkey = user_default_key
216+
with open(data.ssh_pubkey) as f:
217+
data.pub_key_content = f.readline().rstrip()
218+
return
216219
else:
217220
err('SSH public key was not found or informed by "--ssh-pubkey" option.')
218221

0 commit comments

Comments
 (0)