Reputation: 736
When running a Fabric task on a remote server I get the following stack trace:
[x.x.x.x] run: git fetch && git reset --hard origin/develop
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
self.run()
File "/var/lib/jenkins/jobs/deploy/workspace/.pyenv/lib/python2.6/site-packages/ssh/agent.py", line 115, in run
self._communicate()
File "/var/lib/jenkins/jobs/deploy/workspace/.pyenv/lib/python2.6/site-packages/ssh/agent.py", line 125, in _communicate
events = select([self._agent._conn, self.__inr], [], [], 0.5)
TypeError: argument must be an int, or have a fileno() method.
The fact that the Fabric task is trying to perform a git fetch and that exceptions is raised in ssh/agent.py makes me think something is wrong with SSH authentication.
The same user can run git fetch outside of Fabric, and the task runs fine on my laptop.
What's going on here? How do I resolve this issue?
Upvotes: 11
Views: 3500
Reputation: 3566
I ran into this error while using Fabric with Python/Django when I was trying to execute tasks by hand within ./manage.py shell_plus
.
It turns out (for me) that the error was caused by the fact that my shell_plus was set up to use bpython instead of ipython.
When I ran ./manage.py shell_plus --ipython
instead, everything worked perfectly.
I realize that this probably wasn't a direct answer to your problem, but I figure I might as well leave a note here for anyone else who happens across the issue like I did.
Upvotes: 0
Reputation: 15444
To auto-start ssh-agent when you first login, add this to your ~/.bashrc
:
if [ ! -S ~/.ssh/ssh_auth_sock ]; then
eval `ssh-agent`
ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
ssh-add
fi
export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
Upvotes: 0