Add optional username/password input to autologin
Pass -u <username> to be prompted for a password, which will
then be passed to the Chrome instance started by autologin.
BUG=None
TEST=manual on kevin, log in with and without -u
Change-Id: I5ace24002d857fe3375b9ebd79b8003c992219d5
Reviewed-on: https://chromium-review.googlesource.com/1017817
Commit-Ready: Eric Caruso <ejcaruso@chromium.org>
Tested-by: Eric Caruso <ejcaruso@chromium.org>
Reviewed-by: Dan Erat <derat@chromium.org>
diff --git a/client/bin/autologin.py b/client/bin/autologin.py
index 05d33bc..e2fd6a9 100755
--- a/client/bin/autologin.py
+++ b/client/bin/autologin.py
@@ -10,6 +10,7 @@
import common
import argparse
+import getpass
import sys
from autotest_lib.client.common_lib.cros import chrome
@@ -26,11 +27,19 @@
help='Enable ARC and wait for it to start.')
parser.add_argument('-d', '--dont_override_profile', action='store_true',
help='Keep files from previous sessions.')
+ parser.add_argument('-u', '--username',
+ help='Log in as provided username.')
args = parser.parse_args(args)
+ if args.username:
+ password = getpass.getpass()
+
# Avoid calling close() on the Chrome object; this keeps the session active.
chrome.Chrome(
arc_mode=('enabled' if args.arc else None),
+ username=args.username,
+ password=(password if args.username else None),
+ gaia_login=(args.username is not None),
dont_override_profile=args.dont_override_profile)