When deploy-local is called directly, either from the shell or from puppet, the active pty might refer to a user other than the current effective uid. For the deployment host, looking up the real logged in user makes sense, but deploy-local shouldn't try to sudo back to root ( whatever user happens to be running sudo puppet agent --test)
So I'm thinking we should either 1) provide a constructor in TargetContext that overrides super:
class TargetContext(Context): """Manages target host paths and execution context.""" def __init__(self, root, environment=None, user=None): if user is None: user = utils.get_username() super(self.__class__, self).__init__(root, environment, user)
Or, 2) pass the current effective user explicitly to TargetContext() in deploy.py line 64
@thcipriani, @dduvall: thoughts?