changeset 587:0ac21e3343a4

0.6dev: Adding `-P` option to bitten-slave to prompt for password as alternative to command-line option or configuration file. Closes #402. Thanks to Mike Lundy for idea and initial patch.
author osimons
date Sat, 25 Jul 2009 00:37:23 +0000
parents 246f211c1328
children ba53929c8652
files bitten/slave.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/slave.py
+++ b/bitten/slave.py
@@ -358,6 +358,11 @@
                       help='the username to use for authentication')
     parser.add_option('-p', '--password', dest='password',
                       help='the password to use when authenticating')
+    def _ask_password(option, opt_str, value, parser):
+        from getpass import getpass
+        parser.values.password = getpass('Passsword: ')
+    parser.add_option('-P', '--ask-password', action='callback',
+                      callback=_ask_password, help='Prompt for password')
 
     group = parser.add_option_group('building')
     group.add_option('-d', '--work-dir', action='store', dest='work_dir',
Copyright (C) 2012-2017 Edgewall Software