undercloud: introduce deployment_user parameter
deployment_user is a new parameter, default to getpass.getuser(), will feed DeploymentUser parameter in THT, primarly used to add the user to the 'docker' group, so our operators can run the `overcloud container` commands when the undercloud is containerized. Right now, the docker group was modified in puppet with instack-undercloud but with the heat-installer we want to do it in tripleoclient. DeploymentUser was chosen to be "standard" and can be used for both undercloud & overclouds notions. Change-Id: Ia5cc7b34ebee8cf2f49300ce23050370d5f1038a
This commit is contained in:
parent
56e009bd86
commit
714195b55d
7
releasenotes/notes/deployment_user-bc451a45754035b9.yaml
Normal file
7
releasenotes/notes/deployment_user-bc451a45754035b9.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Introduce deployment_user parameter, default to the current user,
|
||||
will feed DeploymentUser parameter in THT, primarly used to add the
|
||||
user to the 'docker' group, so our operators can run the `overcloud
|
||||
container` commands when the undercloud is containerized.
|
@ -204,6 +204,12 @@ class TestEnsureRunAsNormalUser(TestCase):
|
||||
self.assertRaises(exceptions.RootUserExecution,
|
||||
utils.ensure_run_as_normal_user)
|
||||
|
||||
@mock.patch('getpass.getuser')
|
||||
def test_get_deployment_user(self, mock_getpass):
|
||||
mock_getpass.return_value = 'stack'
|
||||
u = utils.get_deployment_user()
|
||||
self.assertEqual('stack', u)
|
||||
|
||||
|
||||
class TestCreateOvercloudRC(TestCase):
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
from __future__ import print_function
|
||||
import csv
|
||||
import datetime
|
||||
import getpass
|
||||
import glob
|
||||
import hashlib
|
||||
import logging
|
||||
@ -428,6 +429,11 @@ def ensure_run_as_normal_user():
|
||||
' Switch to a normal user.')
|
||||
|
||||
|
||||
def get_deployment_user():
|
||||
"""Return the user name which is used to deploy the cloud"""
|
||||
return getpass.getuser()
|
||||
|
||||
|
||||
def capabilities_to_dict(caps):
|
||||
"""Convert the Node's capabilities into a dictionary."""
|
||||
if not caps:
|
||||
|
@ -23,6 +23,7 @@ import logging
|
||||
import netaddr
|
||||
import os
|
||||
from oslo_config import cfg
|
||||
from tripleoclient import utils
|
||||
from tripleoclient.v1 import undercloud_preflight
|
||||
import yaml
|
||||
|
||||
@ -65,6 +66,11 @@ PATHS = Paths()
|
||||
# When adding new options to the lists below, make sure to regenerate the
|
||||
# sample config by running "tox -e genconfig" in the project root.
|
||||
_opts = [
|
||||
cfg.StrOpt('deployment_user',
|
||||
help=('User used to run openstack undercloud install command '
|
||||
'which will be used to add the user to the docker group, '
|
||||
'required to upload containers'),
|
||||
),
|
||||
cfg.StrOpt('undercloud_hostname',
|
||||
help=('Fully qualified hostname (including domain) to set on '
|
||||
'the Undercloud. If left unset, the '
|
||||
@ -602,6 +608,9 @@ def prepare_undercloud_deploy(upgrade=False, no_validations=False):
|
||||
tht_templates,
|
||||
'environments/services-docker/undercloud-keepalived.yaml')]
|
||||
|
||||
u = CONF.get('deployment_user') or utils.get_deployment_user()
|
||||
env_data['DeploymentUser'] = u
|
||||
|
||||
deploy_args += [
|
||||
"-e", os.path.join(tht_templates, "environments/docker.yaml"),
|
||||
"-e",
|
||||
|
Loading…
x
Reference in New Issue
Block a user