Merge pull request #1883 from tgerla/devel

--private-key tilde handling
This commit is contained in:
Michael DeHaan 2013-01-21 06:52:57 -08:00
commit dabe49277a
4 changed files with 4 additions and 3 deletions

View file

@ -46,6 +46,7 @@ Ansible Changes By Release
* SELinux fix for files created by authorized_key module
* "template override" ??
* lots of documentation tweaks
* handle tilde shell character for --private-key
* ...

View file

@ -197,7 +197,7 @@ Set up SSH agent to avoid retyping passwords:
$ ssh-agent bash
$ ssh-add ~/.ssh/id_rsa
(Depending on your setup, you may wish to ansible's --private-key-file option to specify a pem file instead)
(Depending on your setup, you may wish to ansible's --private-key option to specify a pem file instead)
Now ping all your nodes:

View file

@ -82,7 +82,7 @@ class Connection(object):
allow_agent = False
try:
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)
except Exception, e:
msg = str(e)

View file

@ -53,7 +53,7 @@ class Connection(object):
if self.port is not None:
self.common_args += ["-o", "Port=%d" % (self.port)]
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:
self.common_args += ["-o", "GSSAPIAuthentication=no",
"-o", "PubkeyAuthentication=no"]