PSSH uses Python's getpass.getpass to ask for the password. Its
documentation shows that it sends the prompt to the tty (and uses stderr
as a fallback). This would indeed be problematic inside another Python
script.
My opinion (and I'd love to hear any contrary opinions) is that the best
way to support your use case is to allow psshlib to be used directly
from other scripts. There is already some support for this, but you
would be the first person to take advantage of this. To use psshlib,
you would essentially duplicate the do_pssh function, with appropriate
customization for your specific needs.
Would you like to be the guinea pig for this feature? If so, there are
a couple of things to pay attention to:
1) The Manager and PasswordServer classes would need to be able to take
the password as an argument.
2) Note that psshlib will reset some signal handlers. In your case, you
can just reset them after psshlib finishes running. Ideally, we should
put the signal-handling code in a separate process, so that it's not a
problem (this hasn't happened yet because no one has used psshlib
separately).
3) It would be very helpful if you would update us on how things go. If
using psshlib works, and if you were able to provide some documentation,
then this would be more readily available for other future users.
Any thoughts? Or did this scare you off? :)
--
Andrew McNabb
http://www.mcnabbs.org/andrew/
PGP Fingerprint: 8A17 B57C 6879 1863 DE55 8012 AB4D 6098 8826 6868