Expand ~ shell shortcuts for the --private-key argument

This commit is contained in:
Tim Gerla 2013-01-20 13:16:01 -08:00
parent 7df3d811f2
commit 4c64d0d6be
2 changed files with 2 additions and 2 deletions

View file

@ -82,7 +82,7 @@ class Connection(object):
allow_agent = False allow_agent = False
try: try:
ssh.connect(self.host, username=user, allow_agent=allow_agent, look_for_keys=True, ssh.connect(self.host, username=user, allow_agent=allow_agent, look_for_keys=True,
key_filename=self.runner.private_key_file, password=self.runner.remote_pass, key_filename=os.path.expanduser(self.runner.private_key_file), password=self.runner.remote_pass,
timeout=self.runner.timeout, port=self.port) timeout=self.runner.timeout, port=self.port)
except Exception, e: except Exception, e:
msg = str(e) msg = str(e)

View file

@ -53,7 +53,7 @@ class Connection(object):
if self.port is not None: if self.port is not None:
self.common_args += ["-o", "Port=%d" % (self.port)] self.common_args += ["-o", "Port=%d" % (self.port)]
if self.runner.private_key_file is not None: if self.runner.private_key_file is not None:
self.common_args += ["-o", "IdentityFile="+self.runner.private_key_file] self.common_args += ["-o", "IdentityFile="+os.path.expanduser(self.runner.private_key_file)]
if self.runner.remote_pass: if self.runner.remote_pass:
self.common_args += ["-o", "GSSAPIAuthentication=no", self.common_args += ["-o", "GSSAPIAuthentication=no",
"-o", "PubkeyAuthentication=no"] "-o", "PubkeyAuthentication=no"]