fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] Potential Bug with calling psql (postgres command line)


From: Jeff Forcier
Subject: Re: [Fab-user] Potential Bug with calling psql (postgres command line)
Date: Thu, 2 Jul 2009 18:01:12 -0400

Hi Jorge,

This is something that's definitely on my radar and has been in the
TODO doc/code comments for a very long time, and I hope to include
something like this in Fab 1.0. It's possibly the single
highest-impact new feature I can think of, outside of parallelism.
Offhand I think it would be a combination of:

* automatically detecting prompts (e.g. looking for output on a line
containing the word "password" and ending with a colon), and
* allowing users to manually specify a string or strings to match
against, either adding to or overwriting the automatic detection

Then, if "a prompt" is detected (and, possibly, also checking to make
sure the remote end isn't sending any further data) Fabric would do
what it currently does for sudo prompts, namely pass the prompt
through to the user.


However, this is *not* implemented yet, so the workaround is simply to
find some way to make your commands non-interactive.

With Postgres in particular, you could set things up so the user you
run PostgreSQL as doesn't need a password (i.e. by using 'ident
sameuser'), or you could echo the password into the psql call
(sudo('echo "mypass" | psql -U postgres')). These are both suboptimal
workarounds, but would let you do what needs doing. Similar approaches
can be found for just about anything out there.


Best,
Jeff

On Thu, Jul 2, 2009 at 5:47 PM, Jorge Vargas<address@hidden> wrote:
> Hi,
>
> So today I was writing some code to execute psql statements, and I
> found the following.
>
> with the following function:
>
> def postgre_test():
>    sudo('psql -U postgres')
>
> I get
>
> $ fab postgre_test -u jorge
> No hosts found. Please specify (single) host string for connection: *****
> [*****] sudo: psql -U postgres
> Password:
> [*****] err: /bin/bash: psql: command not found
>
> Fatal error: sudo() encountered an error (return code 127) while
> executing 'psql -U postgres'
>
> Aborting.
> Disconnecting from *****... done.
>
>
> doing the same thing from the CLI I get the proper password dialog
>
> address@hidden ~]# psql -U postgres
> Password for user postgres:
>
> I assume the problem is that that password prompt is psql, so fabric
> has no way of knowing about it.
>
> So my question is how can I get this to work?
>
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/fab-user
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]