From 9f41f9556e25cf6f54d036a9ec8b40274b3153c2 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Thu, 19 Jul 2018 21:51:32 -0400 Subject: [PATCH] Default --deployment-user to $SUDO_USER We know this is running under sudo, since we explicitly run it as such. $SUDO_USER is a better default for --deployment-user in that case instead of just assuming stack. When $SUDO_USER is unset, it still falls back to stack. Change-Id: I4234274f41e9e565893b212238d4ab65a075c5e3 --- tripleoclient/v1/tripleo_deploy.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tripleoclient/v1/tripleo_deploy.py b/tripleoclient/v1/tripleo_deploy.py index f21bad41d..0a90157bb 100644 --- a/tripleoclient/v1/tripleo_deploy.py +++ b/tripleoclient/v1/tripleo_deploy.py @@ -841,9 +841,10 @@ class Deploy(command.Command): parser.add_argument( '--deployment-user', dest='deployment_user', - default='stack', + default=os.environ.get('SUDO_USER', 'stack'), help=_('User who executes the tripleo deploy command. ' - 'Defaults to stack.') + 'Defaults to $SUDO_USER. If $SUDO_USER is unset ' + 'it defaults to stack.') ) parser.add_argument( '--heat-container-image', metavar='',