Allow to hide openrc and clouds.yaml download links

Operators now can control whether the links of "Download OpenRC" and
"Download clouds.yaml" are displayed or not via new settings
SHOW_OPENRC_FILE and SHOW_OPENSTACK_CLOUDS_YAML.
openrc and clouds.yaml files provided by horizon now assume
the basic simple deployment and do not cover keystone authentication
like saml2, openid and so on. The default openrc and clouds.yaml
from horizon do not make sense for such environments.

Change-Id: I1407a24387c7d7bd2c20c995cebf1350f8090e72
Partial-Bug: #1795851
This commit is contained in:
Akihiro Motoki 2018-12-23 04:13:07 +09:00
parent d32359e011
commit c6baf00734
5 changed files with 51 additions and 7 deletions

View File

@ -820,6 +820,25 @@ MEMOIZED_MAX_SIZE_DEFAULT allows setting a global default to help control
memory usage when caching. It should at least be 2 x the number of threads
with a little bit of extra buffer.
SHOW_OPENRC_FILE
----------------
.. versionadded:: 15.0.0(Stein)
Default:: ``True``
Controls whether the keystone openrc file is accesible from the user
menu and the api access panel.
SHOW_OPENSTACK_CLOUDS_YAML
--------------------------
.. versionadded:: 15.0.0(Stein)
Default:: ``True``
Controls whether clouds.yaml is accesible from the user
menu and the api access panel.
SHOW_KEYSTONE_V2_RC
--------------------

View File

@ -51,6 +51,9 @@ class DownloadCloudsYaml(tables.LinkAction):
icon = "download"
url = "horizon:project:api_access:clouds.yaml"
def allowed(self, request, datum=None):
return settings.SHOW_OPENSTACK_CLOUDS_YAML
class DownloadOpenRC(tables.LinkAction):
name = "download_openrc"
@ -68,7 +71,8 @@ class DownloadOpenRC(tables.LinkAction):
self.verbose_name = _("OpenStack RC File (Identity API v3)")
def allowed(self, request, datum=None):
return utils.get_keystone_version() >= 3
return (settings.SHOW_OPENRC_FILE and
utils.get_keystone_version() >= 3)
class DownloadOpenRCv2(tables.LinkAction):

View File

@ -114,6 +114,14 @@ WEBROOT = '/'
# and the API Access page
#SHOW_KEYSTONE_V2_RC = False
# Controls whether the keystone openrc file is accesible from the user
# menu and the api access panel.
SHOW_OPENRC_FILE = True
# Controls whether clouds.yaml is accesible from the user
# menu and the api access panel.
SHOW_OPENSTACK_CLOUDS_YAML = True
# If provided, a "Report Bug" link will be displayed in the site header
# which links to the value of this setting (ideally a URL containing
# information on how to report issues).

View File

@ -340,6 +340,8 @@ CSRF_COOKIE_AGE = None
COMPRESS_OFFLINE_CONTEXT = 'horizon.themes.offline_context'
SHOW_KEYSTONE_V2_RC = False
SHOW_OPENRC_FILE = True
SHOW_OPENSTACK_CLOUDS_YAML = True
# Dictionary of currently available angular features
ANGULAR_FEATURES = {
@ -421,12 +423,13 @@ if USER_MENU_LINKS is None:
'icon_classes': ['fa-download', ],
'url': 'horizon:project:api_access:openrcv2',
})
USER_MENU_LINKS.append({
'name': (_('OpenStack RC File v3') if SHOW_KEYSTONE_V2_RC
else _('OpenStack RC File')),
'icon_classes': ['fa-download', ],
'url': 'horizon:project:api_access:openrc',
})
if SHOW_OPENRC_FILE:
USER_MENU_LINKS.append({
'name': (_('OpenStack RC File v3') if SHOW_KEYSTONE_V2_RC
else _('OpenStack RC File')),
'icon_classes': ['fa-download', ],
'url': 'horizon:project:api_access:openrc',
})
if not WEBROOT.endswith('/'):
WEBROOT += '/'

View File

@ -0,0 +1,10 @@
---
features:
- |
[:bug:`1795851`] Operators now can control whether the links of
"Download OpenRC" and "Download clouds.yaml" are displayed or not
via new settings ``SHOW_OPENRC_FILE`` and ``SHOW_OPENSTACK_CLOUDS_YAML``.
``openrc`` and ``clouds.yaml`` files provided by horizon now assume
the basic simple deployment and do not cover keystone authentication
like saml2, openid and so on. The default ``openrc`` and ``clouds.yaml``
from horizon do not make sense for such environments.