Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Fabric throw 'TypeError: argument must be an int, or have a fileno() method'?

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?

like image 930
Fredrik Avatar asked Jun 07 '12 15:06

Fredrik


1 Answers

An issue raised on Fabric's issue tracker mentions that the error might arise from not having ssh-agent running on the host.

I solved the problem by starting an ssh-agent and adding the user's key:

$> eval `ssh-agent`
$> ssh-add ~/.ssh/id_rsa

Success!

like image 166
Fredrik Avatar answered Oct 14 '22 06:10

Fredrik