Push the username/password is None logic down into the interactive prompt method and have the --username/--password options override the values obtained in the method if set
Review Request #4785 — Created Oct. 17, 2013 and submitted
This will make it so rbt post is bug compatible with post-review
when I specify --username on the command line, so it doesn't
always ask me for a username if I specified one via --usernameThis resolves Issue 3114
Sponsored-by: Zonar Systems, Inc
Signed-off-by: Garrett Cooper yanegomi@gmail.com
garrett.cooper@ZL00757 ~/git/rbtools
$ rbt post --diff-filename 0001-Push-the-username-password-is-None-logic-down-into-t.patch
Review request #4786 posted.http://reviews.reviewboard.org/r/4786/
garrett.cooper@ZL00757 ~/git/rbtools
$ rbt post --username yaneurabeya --diff-filename 0001-Push-the-username-password-is-None-logic-down-into-t.patch
==> HTTP Authentication Required
Enter authorization information for "Web API" at reviews.reviewboard.org
Password: Traceback (most recent call last):
File "/usr/bin/rbt", line 8, in <module>
load_entry_point('RBTools==0.5.2.dev', 'console_scripts', 'rbt')()
File "/usr/lib/python2.7/site-packages/RBTools-0.5.2.dev-py2.7.egg/rbtools/commands/main.py", line 106, in main
command.run_from_argv([RB_MAIN] + args)
File "/usr/lib/python2.7/site-packages/RBTools-0.5.2.dev-py2.7.egg/rbtools/commands/init.py", line 157, in run_from_argv
exit_code = self.main(args) or 0
File "/usr/lib/python2.7/site-packages/RBTools-0.5.2.dev-py2.7.egg/rbtools/commands/post.py", line 464, in main
api_client, api_root = self.get_api(server_url)
File "/usr/lib/python2.7/site-packages/RBTools-0.5.2.dev-py2.7.egg/rbtools/commands/init.py", line 261, in get_api
api_root = api_client.get_root()
File "/usr/lib/python2.7/site-packages/RBTools-0.5.2.dev-py2.7.egg/rbtools/api/client.py", line 16, in get_root
return self._transport.get_root(args, **kwargs)
File "/usr/lib/python2.7/site-packages/RBTools-0.5.2.dev-py2.7.egg/rbtools/api/transport/sync.py", line 35, in get_root
return self._execute_request(HttpRequest(self.server.url))
File "/usr/lib/python2.7/site-packages/RBTools-0.5.2.dev-py2.7.egg/rbtools/api/transport/sync.py", line 69, in _execute_request
rsp = self.server.make_request(request)
File "/usr/lib/python2.7/site-packages/RBTools-0.5.2.dev-py2.7.egg/rbtools/api/request.py", line 414, in make_request
rsp = urllib2.urlopen(r)
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 402, in open
req = meth(req)
File "/usr/lib/python2.7/site-packages/RBTools-0.5.2.dev-py2.7.egg/rbtools/api/request.py", line 151, in http_request
self.password_mgr.find_user_password('Web API', self.url)
File "/usr/lib/python2.7/site-packages/RBTools-0.5.2.dev-py2.7.egg/rbtools/api/request.py", line 236, in find_user_password
password=self.rb_pass)
File "/usr/lib/python2.7/site-packages/RBTools-0.5.2.dev-py2.7.egg/rbtools/commands/init.py", line 237, in credentials_prompt
password = getpass.getpass('Password: ')
File "/usr/lib/python2.7/getpass.py", line 71, in unix_getpass
passwd = _raw_input(prompt, stream, input=input)
File "/usr/lib/python2.7/getpass.py", line 133, in _raw_input
line = input.readline()
KeyboardInterrupt