1

I'm working on the deployment tool in Django and fabric. The case is putting some parameters (like hostname and username) in the initial form, then let Django app to call fabric methods to do the rest and collect the output in the web browser.

IF there is a password prompt from OS to fabric (ie. running sudo commands etc.), I would like to popup the one-field form for the password to be put in it (for example using jQuery UI elements). The person will fill the password field for user prompted and fabric will continue to do the things. Is this situation possible to be implemented? I was thinking about some async calls to browser, but I have no idea how it can be done from the other side. Probably there is another way.

Please let me know if you have any suggestions. Thanks!

user1029968
  • 297
  • 2
  • 19

2 Answers2

2

Yes, capture the password exception, than popup the form, and run the fabric script again with env.password = userpassword

If you want to continue where you caught the exception, keep a variable that knows what has been done yet (i.e. nlinesexecuted) and save it when you catch the exception. Use logic when you rerun the script to continue where you left of.

Jasper van den Bosch
  • 3,169
  • 4
  • 32
  • 55
1

I can't think of a way to do a password prompt only if required... you could prompt before and cache it as required, though, and the backend would have access.

To pass the sudo password to the fabric command, you can use sudo -S... i.e.

echo password | sudo -S command

Brandongk
  • 111
  • 1