From 38b6e1b6af66f80ce226472e58e92fa777efe30f Mon Sep 17 00:00:00 2001 From: gryf Date: Sat, 10 Apr 2021 16:48:55 +0200 Subject: [PATCH] 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. --- box.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/box.py b/box.py index 27d2374..75fe45e 100755 --- a/box.py +++ b/box.py @@ -83,6 +83,9 @@ class VMCreate: if not self.ssh_key_path.endswith('.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): raise BoxNotFound(f'Cannot find default ssh public key: ' f'{self.ssh_key_path}')