Merge "Allow to hide openrc and clouds.yaml download links"

This commit is contained in:
Zuul 2019-01-13 16:43:52 +00:00 committed by Gerrit Code Review
commit a1ffa9620e
5 changed files with 51 additions and 7 deletions

View File

@ -835,6 +835,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

@ -348,6 +348,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 = {
@ -429,6 +431,7 @@ if USER_MENU_LINKS is None:
'icon_classes': ['fa-download', ],
'url': 'horizon:project:api_access:openrcv2',
})
if SHOW_OPENRC_FILE:
USER_MENU_LINKS.append({
'name': (_('OpenStack RC File v3') if SHOW_KEYSTONE_V2_RC
else _('OpenStack RC File')),

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.