Gringo Suave
Gringo Suave

Reputation: 31958

fabric task error when prompting for password

I'm having an error I can't seem to get past. I have a simple fabric task that must be run as a different user on the remote system, e.g:

def update():
    env.user = 'otheruser'
    #~ env.password = 'otherpass'  # this works, but I don't want it here.
    with cd(env.sitefolder):
        run('hg pull -u')

If I run this with env.password hardcoded it works. If I use fab -p otherpass update it works too. If I omit it the docs say I will get prompted. This is true, but it doesn't work. Every time after entering the password I get this error:

> fab dev update
[darkstar] Executing task 'update'
[darkstar] run: hg pull -u
[darkstar] Login password: 
ERROR:paramiko.transport:Exception: Error reading SSH protocol banner
...
Fatal error: Error reading SSH protocol banner

Aborting.

Using fabric 1.2.2 on Ubuntu Natty. I also tried the env.no_keys option but it didn't change anything. Can anyone help?

Upvotes: 2

Views: 2754

Answers (2)

Franck
Franck

Reputation: 325

This can also happen if target is out of memory/disk space. Restarting and/or solving memory/disk space problems can solve this.

Upvotes: 1

Matt Sweeney
Matt Sweeney

Reputation: 2130

Prompt for the password yourself!

def update():
    env.user = 'otheruser'
    env.password = getpass.getpass('Enter password: ')
    with cd(env.sitefolder):
        run('hg pull -u')

getpass is part of the standard library, it's just a raw_input that doesn't echo what you type

Upvotes: 5

Related Questions