buildbot/buildbot — pull request #684 by andrewjcg (2013-03-31 06:59:22+00:00)
Title: RemoteShellCommand: add parameters to override uid and gid

This adds the ability to run remote shell commands as different user when the buildslave itself is running as root (which is the case when some build steps need to run with root privileges for things like mounting and chroot'ing). Since twisted's spawnProcess API already supports setting a uid/gid, this change basically just threads a user and group through to that call.

I was experimenting with a few tests but the situation is a bit weird since this feature relies on root perms and its unlikely that these tests will ever be run as root. One potential test could check for a invalid permissions errors when trying to use this feature, but this would assume that the tests would always run as non-root. If this isn't acceptable without tests as-is, I can try put something together.