diff --git a/openstack_dashboard/dashboards/project/api_access/templates/api_access/openrc.sh.template b/openstack_dashboard/dashboards/project/api_access/templates/api_access/openrc.sh.template index 1c27c30571..ff576a0998 100644 --- a/openstack_dashboard/dashboards/project/api_access/templates/api_access/openrc.sh.template +++ b/openstack_dashboard/dashboards/project/api_access/templates/api_access/openrc.sh.template @@ -19,6 +19,8 @@ export OS_PROJECT_ID={{ tenant_id }} export OS_PROJECT_NAME="{{ tenant_name|shellfilter }}" export OS_USER_DOMAIN_NAME="{{ user_domain_name|shellfilter }}" if [ -z "$OS_USER_DOMAIN_NAME" ]; then unset OS_USER_DOMAIN_NAME; fi +export OS_PROJECT_DOMAIN_ID="{{ project_domain_id|shellfilter }}" +if [ -z "$OS_PROJECT_DOMAIN_ID" ]; then unset OS_PROJECT_DOMAIN_ID; fi # unset v2.0 items in case set unset OS_TENANT_ID diff --git a/openstack_dashboard/dashboards/project/api_access/views.py b/openstack_dashboard/dashboards/project/api_access/views.py index 9456f63384..4ef9c6df3d 100644 --- a/openstack_dashboard/dashboards/project/api_access/views.py +++ b/openstack_dashboard/dashboards/project/api_access/views.py @@ -136,6 +136,11 @@ def download_rc_file(request): # make v3 specific changes context['user_domain_name'] = request.user.user_domain_name + try: + project_domain_id = request.user.token.project['domain_id'] + except KeyError: + project_domain_id = '' + context['project_domain_id'] = project_domain_id # sanity fix for removing v2.0 from the url if present context['auth_url'], _ = utils.fix_auth_url_version_prefix( context['auth_url'])