Update cros_sdk and deploy_chrome to not require ttyless sudo ticket.
In sudo 1.7.2p1, when tty_tickets was enabled, you still create ttyless
sudo sessions so that you did not need to enter your password. In sudo
1.8.3p1, passwords are not saved for ttyless sudo sessions, so cros_sdk
asks you for a password every time you run it.
To work around the problem, I've made the following changes:
- cros_sdk and deploy_chrome don't require a ttyless sudo ticket anymore.
- cbuildbot now checks for errors, and fails immediately if it can't create
a ttyless sudo ticket.
I've also updated the keepalive daemon to fail explicitly if run as root,
since this has never been supported and already fails with exceptions for
all programs that use the keepalive daemon.
In all cases, we now print a warning if the user has not set up their
tty_tickets configuration correctly.
BUG=chromium-os:33686
TEST=cros_sdk now doesn't ask for a password every time on gPrecise, even if
tty_tickets is disabled. cbuildbot, on the other hand, fails immediately
with a nice error message explaining how to set up tty_tickets.
With and without the CL, sh -c 'echo hi | cros_sdk true' fails, but the
CL adds a useful warning explaining what to do. pylint. unit tests.
Change-Id: I7ff54d7b8e580e562939dd55e6f00808f5e5c7dc
Reviewed-on: https://gerrit.chromium.org/gerrit/30919
Commit-Ready: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
diff --git a/scripts/cros_sdk.py b/scripts/cros_sdk.py
index c67fe39..8745da7 100644
--- a/scripts/cros_sdk.py
+++ b/scripts/cros_sdk.py
@@ -9,7 +9,6 @@
import logging
import optparse
import os
-import sys
import urlparse
from chromite.buildbot import constants
@@ -378,7 +377,7 @@
lock_path = os.path.dirname(chroot_path)
lock_path = os.path.join(lock_path,
'.%s_lock' % os.path.basename(chroot_path))
- with sudo.SudoKeepAlive():
+ with sudo.SudoKeepAlive(ttyless_sudo=False):
with cgroups.SimpleContainChildren('cros_sdk'):
_CreateLockFile(lock_path)
with locking.FileLock(lock_path, 'chroot lock') as lock: