tobami/littlechef — Issue #79: Environment Variables in .ssh/config
Author: rweng
Created: 2012-01-10 12:21:19+00:00
State: open

Hi, I tried setting a different keyfile in the .ssh/config with

Host ec2-107-20-130-69.compute-1.amazonaws.com
IdentityFile $HOME/.ec2/me.pem

However, neither `$HOME` nor `~` are replaced correctly. It fails with the following error:

~~~
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/fabric/main.py", line 682, in main
*args, **kwargs
File "/Library/Python/2.7/site-packages/fabric/tasks.py", line 232, in execute
task.run(*args, **new_kwargs)
File "/Library/Python/2.7/site-packages/fabric/tasks.py", line 105, in run
return self.wrapped(*args, **kwargs)
File "/Library/Python/2.7/site-packages/littlechef/runner.py", line 182, in recipe
chef.sync_node(data)
File "/Library/Python/2.7/site-packages/littlechef/chef.py", line 76, in sync_node
solo.configure(current_node)
File "/Library/Python/2.7/site-packages/littlechef/solo.py", line 59, in configure
if not exists(cache_dir):
File "/Library/Python/2.7/site-packages/fabric/contrib/files.py", line 35, in exists
return not func(cmd).failed
File "/Library/Python/2.7/site-packages/fabric/network.py", line 343, in host_prompting_wrapper
return func(*args, **kwargs)
File "/Library/Python/2.7/site-packages/fabric/operations.py", line 948, in run
return _run_command(command, shell, pty, combine_stderr)
File "/Library/Python/2.7/site-packages/fabric/operations.py", line 866, in _run_command
stdout, stderr, status = _execute(default_channel(), wrapped_command, pty,
File "/Library/Python/2.7/site-packages/fabric/state.py", line 326, in default_channel
chan = connections[env.host_string].get_transport().open_session()
File "/Library/Python/2.7/site-packages/fabric/network.py", line 74, in __getitem__
self[real_key] = connect(user, host, port)
File "/Library/Python/2.7/site-packages/fabric/network.py", line 199, in connect
look_for_keys=not env.no_keys
File "/Library/Python/2.7/site-packages/ssh/client.py", line 332, in connect
self._auth(username, password, pkey, key_filenames, allow_agent, look_for_keys)
File "/Library/Python/2.7/site-packages/ssh/client.py", line 436, in _auth
key = pkey_class.from_private_key_file(key_filename, password)
File "/Library/Python/2.7/site-packages/ssh/pkey.py", line 198, in from_private_key_file
key = cls(filename=filename, password=password)
File "/Library/Python/2.7/site-packages/ssh/rsakey.py", line 51, in __init__
self._from_private_key_file(filename, password)
File "/Library/Python/2.7/site-packages/ssh/rsakey.py", line 163, in _from_private_key_file
data = self._read_private_key_file('RSA', filename, password)
File "/Library/Python/2.7/site-packages/ssh/pkey.py", line 279, in _read_private_key_file
f = open(filename, 'r')
IOError: [Errno 2] No such file or directory: '$HOME/.ec2/me.pem'
~~~