Commit 4f6d25c4 authored by maruel@chromium.org's avatar maruel@chromium.org

Update upload.py from rietveld @ 7696eca367d2.

---

Trap failure to get password from keyring

It happens when using upload.py from a ssh session without a X session but
gnomekeyring is used.

R=dpranke@chromium.org
BUG=
TEST=

Review URL: http://codereview.chromium.org/7715013

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@97909 0039d316-1c4b-4281-b951-d872f2087c98
parent b615edae
......@@ -612,12 +612,19 @@ def GetRpcServer(server, email=None, host_override=None, save_cookies=True,
"""Prompts the user for a username and password."""
# Create a local alias to the email variable to avoid Python's crazy
# scoping rules.
global keyring
local_email = email
if local_email is None:
local_email = GetEmail("Email (login for uploading to %s)" % server)
password = None
if keyring:
password = keyring.get_password(host, local_email)
try:
password = keyring.get_password(host, local_email)
except:
# Sadly, we have to trap all errors here as
# gnomekeyring.IOError inherits from object. :/
print "Failed to get password from keyring"
keyring = None
if password is not None:
print "Using password from system keyring."
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment