From d32359e0110fa27469fd33fb2197cfc6c45b8c93 Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Sun, 23 Dec 2018 04:01:04 +0900 Subject: [PATCH] SHOW_KEYSTONE_V2_RC defaults to False In favor of keystone v2 support, SHOW_KEYSTONE_V2_RC now defaults to False. SHOW_KEYSTONE_V2_RC setting is also deprecated. Along with this change, "v3" part of "OpenStack RC File (Identity API v3)" is now unnecessary, so "v3" information is dropped. Change-Id: If0359e2dc1f2c8fb5f3c87046fd23043f94abc21 --- doc/source/configuration/settings.rst | 27 +++++++++++++++-- openstack_dashboard/context_processors.py | 2 +- .../dashboards/project/api_access/tables.py | 12 ++++++-- .../local/local_settings.py.example | 2 +- openstack_dashboard/settings.py | 30 ++++++++++++------- ...tone-v2-openrc-false-c7e904473da2f823.yaml | 10 +++++++ 6 files changed, 66 insertions(+), 17 deletions(-) create mode 100644 releasenotes/notes/show-keystone-v2-openrc-false-c7e904473da2f823.yaml diff --git a/doc/source/configuration/settings.rst b/doc/source/configuration/settings.rst index 7e28a76608..cb0c85b885 100644 --- a/doc/source/configuration/settings.rst +++ b/doc/source/configuration/settings.rst @@ -826,7 +826,16 @@ SHOW_KEYSTONE_V2_RC .. versionadded:: 13.0.0(Queens) -Default: ``True`` +.. versionchanged:: 15.0.0(Stein) + + The default value is changed from ``True`` to ``False`` + in favor of the deprecation of keystone v2 API support in horizon. + +.. deprecated:: 15.0.0(Stein) + + This option will be dropped in 16.0.0(Train) release. + +Default: ``False`` Controls whether the keystone v2 openrc file is accessible from the user menu and the api access panel. @@ -858,7 +867,21 @@ USER_MENU_LINKS .. versionadded:: 13.0.0(Queens) -Default:: +Default (when ``SHOW_KEYSTONE_V2_RC`` is ``False``): + +.. code-block:: python + + [ + {'name': _('OpenStack RC File'), + 'icon_classes': ['fa-download', ], + 'url': 'horizon:project:api_access:openrc', + 'external': False, + } + ] + +Default (when ``SHOW_KEYSTONE_V2_RC`` is ``True``): + +.. code-block:: python [ {'name': _('OpenStack RC File v2'), diff --git a/openstack_dashboard/context_processors.py b/openstack_dashboard/context_processors.py index 44e9d2e327..cd655abc94 100644 --- a/openstack_dashboard/context_processors.py +++ b/openstack_dashboard/context_processors.py @@ -88,7 +88,7 @@ def openstack(request): user_menu_links = getattr(settings, "USER_MENU_LINKS", []) - if not getattr(settings, "SHOW_KEYSTONE_V2_RC", True): + if not getattr(settings, "SHOW_KEYSTONE_V2_RC", False): user_menu_links = [ link for link in user_menu_links if 'horizon:project:api_access:openrcv2' != link['url']] diff --git a/openstack_dashboard/dashboards/project/api_access/tables.py b/openstack_dashboard/dashboards/project/api_access/tables.py index 2d8f04921a..9788047b3d 100644 --- a/openstack_dashboard/dashboards/project/api_access/tables.py +++ b/openstack_dashboard/dashboards/project/api_access/tables.py @@ -54,11 +54,19 @@ class DownloadCloudsYaml(tables.LinkAction): class DownloadOpenRC(tables.LinkAction): name = "download_openrc" - verbose_name = _("OpenStack RC File (Identity API v3)") - verbose_name_plural = _("OpenStack RC File (Identity API v3)") + verbose_name = _("OpenStack RC File") + verbose_name_plural = _("OpenStack RC File") icon = "download" url = "horizon:project:api_access:openrc" + def __init__(self, attrs=None, **kwargs): + super(DownloadOpenRC, self).__init__(attrs, **kwargs) + # When keystone v2 RC file is enabled, we need to show + # the version information of keystone API. + # Note that we don't need to care verbose_name_plural here. + if getattr(settings, 'SHOW_KEYSTONE_V2_RC', False): + self.verbose_name = _("OpenStack RC File (Identity API v3)") + def allowed(self, request, datum=None): return utils.get_keystone_version() >= 3 diff --git a/openstack_dashboard/local/local_settings.py.example b/openstack_dashboard/local/local_settings.py.example index 6f366096c6..eb757d7a07 100644 --- a/openstack_dashboard/local/local_settings.py.example +++ b/openstack_dashboard/local/local_settings.py.example @@ -112,7 +112,7 @@ WEBROOT = '/' # Toggle showing the openrc file for Keystone V2. # If set to false the link will be removed from the user dropdown menu # and the API Access page -#SHOW_KEYSTONE_V2_RC = True +#SHOW_KEYSTONE_V2_RC = False # 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 diff --git a/openstack_dashboard/settings.py b/openstack_dashboard/settings.py index 2619acd851..18aae0e97f 100644 --- a/openstack_dashboard/settings.py +++ b/openstack_dashboard/settings.py @@ -307,16 +307,9 @@ SECURITY_GROUP_RULES = { ADD_INSTALLED_APPS = [] -USER_MENU_LINKS = [ - {'name': _('OpenStack RC File v2'), - 'icon_classes': ['fa-download', ], - 'url': 'horizon:project:api_access:openrcv2' - }, - {'name': _('OpenStack RC File v3'), - 'icon_classes': ['fa-download', ], - 'url': 'horizon:project:api_access:openrc' - } -] +# NOTE: The default value of USER_MENU_LINKS will be set after loading +# local_settings if it is not configured. +USER_MENU_LINKS = None # 'key', 'label', 'path' AVAILABLE_THEMES = [ @@ -346,7 +339,7 @@ CSRF_COOKIE_AGE = None COMPRESS_OFFLINE_CONTEXT = 'horizon.themes.offline_context' -SHOW_KEYSTONE_V2_RC = True +SHOW_KEYSTONE_V2_RC = False # Dictionary of currently available angular features ANGULAR_FEATURES = { @@ -420,6 +413,21 @@ if os.path.exists(LOCAL_SETTINGS_DIR_PATH): OPENSTACK_IMAGE_FORMATS = [fmt for (fmt, name) in OPENSTACK_IMAGE_BACKEND['image_formats']] +if USER_MENU_LINKS is None: + USER_MENU_LINKS = [] + if SHOW_KEYSTONE_V2_RC: + USER_MENU_LINKS.append({ + 'name': _('OpenStack RC File v2'), + '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 not WEBROOT.endswith('/'): WEBROOT += '/' if LOGIN_URL is None: diff --git a/releasenotes/notes/show-keystone-v2-openrc-false-c7e904473da2f823.yaml b/releasenotes/notes/show-keystone-v2-openrc-false-c7e904473da2f823.yaml new file mode 100644 index 0000000000..fb2d102bde --- /dev/null +++ b/releasenotes/notes/show-keystone-v2-openrc-false-c7e904473da2f823.yaml @@ -0,0 +1,10 @@ +--- +upgrade: + - | + The default value of ``SHOW_KEYSTONE_V2_RC`` setting is changed to + ``False`` in favor of the deprecation of keystone v2 API support + in horizon. +deprecations: + - | + ``SHOW_KEYSTONE_V2_RC`` setting is deprecated in favor of the deprecation + of keystone v2 API support in horizon.