Set default project domain name to "Default"
Openrc files downloaded through Horizon does not set OS_PROJECT_DOMAIN_NAME. This means openrc files downloaded from horizon cannot be used to issue commands to sw-manager, even if the user they refer to is supposed to be able to issue commands to sw-manager. This is because nfv-client rejects commands if no project domain name is specified. This commit sets the nfv-client's project domain name to "Default" when none is passed through command line parameters or environment variables. The "Default" domain is the default for openstack deployments and starlingx. Assuming it as a default will not expose a security risk as this information is not a secret. Users can override the default value of "Default" by specifying the project domain name through environment variables or the command line. A change in nvf-client is done over a change in horizon in order to minimize changes to components that starlingx does not own. Also, none of starlingx's other components uses the project domain name. Nfv client's authentication mechanism is not changed to use something other than project domain name because that is a major change, and could potentially cause compatibiltiy issues with (orchestrated) upgrades. Test Cases: PASS: sw-manager upgrade-strategy-show with /etc/platform/openrc PASS: sw-manager upgrade-strategy-show with admin openrc from horizon ensure it is successful instead of failure due to lack of project domain name PASS: sw-manager upgrad-estrategy-show with admin openrc from horizon, then manually specifying incorrect OS_PROJECT_DOMAIN_NAME through environment variable. Ensure this failed and that authentication actually uses this field. Change-Id: Ib2e22e9f5556b01115ab0adfb3c9a399825c49d5 Closes-bug: 1989796 Signed-off-by: Jerry Sun <jerry.sun@windriver.com>
This commit is contained in:
parent
0f3aeaa839
commit
f22b46efbf
|
@ -487,7 +487,7 @@ def process_main(argv=sys.argv[1:]): # pylint: disable=dangerous-default-value
|
|||
|
||||
if args.os_project_domain_name is None:
|
||||
args.os_project_domain_name \
|
||||
= os.environ.get('OS_PROJECT_DOMAIN_NAME', None)
|
||||
= os.environ.get('OS_PROJECT_DOMAIN_NAME', 'Default')
|
||||
|
||||
if args.os_username is None:
|
||||
args.os_username = os.environ.get('OS_USERNAME', None)
|
||||
|
|
|
@ -144,6 +144,9 @@ class StrategyMixin(object):
|
|||
"""Test that if any required env variable is missing, it fails"""
|
||||
shell_args = [self.strategy, 'show', ]
|
||||
for pop_env in list(self.MOCK_ENV.keys()):
|
||||
# OS_PROJECT_DOMAIN_NAME was made optional
|
||||
if pop_env == "OS_PROJECT_DOMAIN_NAME":
|
||||
continue
|
||||
# remove the pop_env variable from the environment
|
||||
self._test_shell_show_incomplete_env(shell_args=shell_args,
|
||||
pop_env=pop_env)
|
||||
|
|
Loading…
Reference in New Issue