Discussion:
[Fab-user] when password is wrong
Prasant J
2016-12-05 06:11:56 UTC
Permalink
Hi,

I'm writing a python GUI that uses fabric as library and performs
operations on the remote host.

When the user supplies wrong password, then fabric asks for user to
provide password on the command line. The control drops to the command
line and the prompt is expecting user to input the password and this
does not go well with my GUI application.

How can I prevent this? How can fabric return exception or error when
password supplied is wrong. Basically fabric should give up on the
first attempt when password is incorrect.

Is there any way around this?

Any inputs will be of help!


Regards, Pj
Brandon Whaley
2016-12-05 15:08:46 UTC
Permalink
I would use a combination of
http://docs.fabfile.org/en/1.12/usage/env.html#abort-on-prompts and
http://docs.fabfile.org/en/1.12/usage/env.html#abort-exception to have
Fabric throw a custom exception when it has to prompt, which I would
subsequently catch and handle myself based on context.
Post by Prasant J
Hi,
I'm writing a python GUI that uses fabric as library and performs
operations on the remote host.
When the user supplies wrong password, then fabric asks for user to
provide password on the command line. The control drops to the command
line and the prompt is expecting user to input the password and this
does not go well with my GUI application.
How can I prevent this? How can fabric return exception or error when
password supplied is wrong. Basically fabric should give up on the
first attempt when password is incorrect.
Is there any way around this?
Any inputs will be of help!
Regards, Pj
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
Prasant J
2016-12-13 13:50:50 UTC
Permalink
Thanks Brandon for the response!


I'm using fabric as library in my program.
I'm setting up environment first (env.user, env.password) and then
using run() to execute the command.

How can I set "abort-on-prompts" in this case? (I know how to use from
command line)

Could you please point me to an example or provide some inputs so that
I can use this feature?

Regards, Pj
Post by Brandon Whaley
I would use a combination of
http://docs.fabfile.org/en/1.12/usage/env.html#abort-on-prompts and
http://docs.fabfile.org/en/1.12/usage/env.html#abort-exception to have
Fabric throw a custom exception when it has to prompt, which I would
subsequently catch and handle myself based on context.
Post by Prasant J
Hi,
I'm writing a python GUI that uses fabric as library and performs
operations on the remote host.
When the user supplies wrong password, then fabric asks for user to
provide password on the command line. The control drops to the command
line and the prompt is expecting user to input the password and this
does not go well with my GUI application.
How can I prevent this? How can fabric return exception or error when
password supplied is wrong. Basically fabric should give up on the
first attempt when password is incorrect.
Is there any way around this?
Any inputs will be of help!
Regards, Pj
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
santosh kumar
2017-01-09 08:08:43 UTC
Permalink
I use these for my enviornment

env.skip_bad_hosts = True
env.warn_only = True
env.abort_on_prompts = True
Post by Prasant J
Thanks Brandon for the response!
I'm using fabric as library in my program.
I'm setting up environment first (env.user, env.password) and then
using run() to execute the command.
How can I set "abort-on-prompts" in this case? (I know how to use from
command line)
Could you please point me to an example or provide some inputs so that
I can use this feature?
Regards, Pj
Post by Brandon Whaley
I would use a combination of
http://docs.fabfile.org/en/1.12/usage/env.html#abort-on-prompts and
http://docs.fabfile.org/en/1.12/usage/env.html#abort-exception to have
Fabric throw a custom exception when it has to prompt, which I would
subsequently catch and handle myself based on context.
Post by Prasant J
Hi,
I'm writing a python GUI that uses fabric as library and performs
operations on the remote host.
When the user supplies wrong password, then fabric asks for user to
provide password on the command line. The control drops to the command
line and the prompt is expecting user to input the password and this
does not go well with my GUI application.
How can I prevent this? How can fabric return exception or error when
password supplied is wrong. Basically fabric should give up on the
first attempt when password is incorrect.
Is there any way around this?
Any inputs will be of help!
Regards, Pj
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
Loading...