1
0
mirror of https://github.com/gryf/boxpy.git synced 2025-12-19 13:37:58 +01:00

Add possibility to just pass key name.

From now, it's possible to just pass the key name, not the full path to
the key. By default it will be looked for in ~/.ssh directory.
This commit is contained in:
2021-04-10 16:48:55 +02:00
parent 70248bd23b
commit 38b6e1b6af

3
box.py
View File

@@ -83,6 +83,9 @@ class VMCreate:
if not self.ssh_key_path.endswith('.pub'): if not self.ssh_key_path.endswith('.pub'):
self.ssh_key_path += '.pub' self.ssh_key_path += '.pub'
if not os.path.exists(self.ssh_key_path):
self.ssh_key_path = os.path.join(os.path.expanduser("~/.ssh"),
self.ssh_key_path)
if not os.path.exists(self.ssh_key_path): if not os.path.exists(self.ssh_key_path):
raise BoxNotFound(f'Cannot find default ssh public key: ' raise BoxNotFound(f'Cannot find default ssh public key: '
f'{self.ssh_key_path}') f'{self.ssh_key_path}')