Merge "Drop deprecated settings"

This commit is contained in:
Zuul 2018-03-26 13:12:06 +00:00 committed by Gerrit Code Review
commit d4c81676a0
11 changed files with 22 additions and 229 deletions

View File

@ -134,38 +134,6 @@ the GUI. For example themes, see: /horizon/openstack_dashboard/themes/
Horizon ships with two themes configured. 'default' is the default theme,
and 'material' is based on Google's Material Design.
.. _custom_theme_path:
CUSTOM_THEME_PATH
-----------------
.. versionadded:: 2015.1(Kilo)
.. deprecated:: 9.0.0(Mitaka)
Themes are now controlled by `AVAILABLE_THEMES`_.
Default: ``"themes/default"``
This setting tells Horizon to use a directory as a custom theme.
By default, this directory will serve as the static root of the theme
and the entire contents of the directory will be served up at
``/static/custom``. If you wish to include content other than static
files in a theme directory, but do not wish that content to be served up,
then you can create a sub directory named ``static``. If the theme folder
contains a sub-directory with the name ``static``, then
``static/custom/static`` will be used as the root for the content
served at ``/static/custom``.
The static root of the theme folder must always contain a _variables.scss
file and a _styles.scss file. These must contain or import all the
bootstrap and horizon specific variables and styles which are used to style
the GUI. For example themes, see: /horizon/openstack_dashboard/themes/
Horizon ships with one alternate theme based on Google's Material Design. To
use the alternate theme, set your CUSTOM_THEME_PATH to ``themes/material``.
DEFAULT_THEME
-------------
@ -182,24 +150,6 @@ must be configured as part of `SELECTABLE_THEMES`_. If it is not, then
your ``DEFAULT_THEME`` will default to the first theme in
``SELECTABLE_THEMES``.
DEFAULT_THEME_PATH
------------------
.. versionadded:: 8.0.0(Liberty)
.. deprecated:: 9.0.0(Mitaka)
Themes are now controlled by `AVAILABLE_THEMES`_.
Default: ``"themes/default"``
This setting allows Horizon to collect an additional theme during static
collection and be served up via /static/themes/default. This is useful
if CUSTOM_THEME_PATH inherits from another theme (like 'default').
If DEFAULT_THEME_PATH is the same as CUSTOM_THEME_PATH, then collection
is skipped and /static/themes will not exist.
DISALLOW_IFRAME_EMBED
---------------------
@ -1022,33 +972,6 @@ Valid values are ``"public"`` and ``"private"``. By default, the visibility
option is public on create image modal. If it's set to ``"private"``, the
default visibility option is private.
HORIZON_IMAGES_ALLOW_UPLOAD
~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 2013.1(Grizzly)
.. deprecated:: 10.0.0(Newton)
Use `HORIZON_IMAGES_UPLOAD_MODE`_ instead.
Default: ``True``
If set to ``False``, this setting disables **local** uploads to prevent filling
up the disk on the dashboard server since uploads to the Glance image store
service tend to be particularly large - in the order of hundreds of megabytes
to multiple gigabytes.
The setting is marked as deprecated and will be removed in P or later release.
It is superseded by the setting HORIZON_IMAGES_UPLOAD_MODE. Until the removal
the ``False`` value of HORIZON_IMAGES_ALLOW_UPLOAD overrides the value of
HORIZON_IMAGES_UPLOAD_MODE.
.. note::
This will not disable image creation altogether, as this setting does not
affect images created by specifying an image location (URL) as the image
source.
HORIZON_IMAGES_UPLOAD_MODE
~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1056,12 +979,10 @@ HORIZON_IMAGES_UPLOAD_MODE
Default: ``"legacy"``
Valid values are ``"direct"``, ``"legacy"`` (default) and ``"off"``. ``"off"``
disables the ability to upload images via Horizon. It is equivalent to setting
``False`` on the deprecated setting ``HORIZON_IMAGES_ALLOW_UPLOAD``. ``legacy``
enables local file upload by piping the image file through the Horizon's
web-server. It is equivalent to setting ``True`` on the deprecated setting
``HORIZON_IMAGES_ALLOW_UPLOAD``. ``direct`` sends the image file directly from
Valid values are ``"direct"``, ``"legacy"`` (default) and ``"off"``.
``"off"`` disables the ability to upload images via Horizon.
``legacy`` enables local file upload by piping the image file through the
Horizon's web-server. ``direct`` sends the image file directly from
the web browser to Glance. This bypasses Horizon web-server which both reduces
network hops and prevents filling up Horizon web-server's filesystem. ``direct``
is the preferred mode, but due to the following requirements it is not the
@ -1076,15 +997,6 @@ restart glance-api process.
.. _here: https://docs.openstack.org/oslo.middleware/latest/reference/cors.html#configuration-for-oslo-config
.. note::
To maintain the compatibility with the deprecated HORIZON_IMAGES_ALLOW_UPLOAD
setting, neither ``"direct"``, nor ``"legacy"`` modes will have an effect if
HORIZON_IMAGES_ALLOW_UPLOAD is set to ``False`` - as if HORIZON_IMAGES_UPLOAD_MODE
was set to ``"off"`` itself. When HORIZON_IMAGES_ALLOW_UPLOAD is set to ``True``,
all three modes are considered, as if HORIZON_IMAGES_ALLOW_UPLOAD setting
was removed.
IMAGE_CUSTOM_PROPERTY_TITLES
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1441,23 +1353,6 @@ algorithm that the identity (Keystone) server and the auth_token middleware
are using. Allowed values are the algorithms supported by Python's hashlib
library.
OPENSTACK_TOKEN_HASH_ENABLED
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 8.0.0(Liberty)
.. deprecated:: 9.0.0(Mitaka)
PKI tokens currently work with hashing, and Keystone will soon deprecate
usage of PKI tokens.
Default: ``True``
Hashing tokens from Keystone keeps the Horizon session data smaller, but it
doesn't work in some cases when using PKI tokens. Uncomment this value and
set it to False if using PKI tokens and there are 401 errors due to token
hashing.
PASSWORD_EXPIRES_WARNING_THRESHOLD_DAYS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -26,7 +26,6 @@ from openstack_auth import utils
LOG = logging.getLogger(__name__)
_TOKEN_HASH_ENABLED = getattr(settings, 'OPENSTACK_TOKEN_HASH_ENABLED', True)
def set_session_from_user(request, user):
@ -91,7 +90,7 @@ class Token(object):
# Token-related attributes
self.id = auth_ref.auth_token
self.unscoped_token = unscoped_token
if _TOKEN_HASH_ENABLED and self._is_pki_token(self.id):
if self._is_pki_token(self.id):
algorithm = getattr(settings, 'OPENSTACK_TOKEN_HASH_ALGORITHM',
'md5')
hasher = hashlib.new(algorithm)

View File

@ -116,13 +116,6 @@ def is_safe_url(url, host=None):
return not netloc or netloc == host
# DEPRECATED -- Mitaka
# This method definition is included to prevent breaking backward compatibility
# The original functionality was problematic and has been removed.
def remove_project_cache(token):
pass
# Helper for figuring out keystone version
# Implementation will change when API version discovery is available
def get_keystone_version():
@ -146,11 +139,6 @@ def get_keystone_client():
return client_v3
def is_token_deletion_disabled():
LOG.warning("Deprecated TOKEN_DELETION_DISABLED setting is no longer used")
return getattr(settings, 'TOKEN_DELETION_DISABLED', False)
def is_websso_enabled():
"""Websso is supported in Keystone version 3."""
websso_enabled = getattr(settings, 'WEBSSO_ENABLED', False)

View File

@ -178,11 +178,6 @@ def logout(request, login_url=None, **kwargs):
**kwargs)
def delete_token(endpoint, token_id):
"""Delete a token."""
LOG.warning("The delete_token method is deprecated and now does nothing")
@login_required
def switch(request, tenant_id, redirect_field_name=auth.REDIRECT_FIELD_NAME):
"""Switches an authenticated user from one project to another."""

View File

@ -377,8 +377,6 @@ def image_update(request, image_id, **kwargs):
def get_image_upload_mode():
if getattr(settings, 'HORIZON_IMAGES_ALLOW_UPLOAD', None) is False:
return 'off'
mode = getattr(settings, 'HORIZON_IMAGES_UPLOAD_MODE', 'legacy')
if mode not in ('off', 'legacy', 'direct'):
LOG.warning('HORIZON_IMAGES_UPLOAD_MODE has an unrecognized value of '

View File

@ -20,7 +20,6 @@ import tempfile
from django.conf import settings
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.forms.widgets import HiddenInput
from django.test.utils import override_settings
from django.urls import reverse
@ -66,28 +65,6 @@ class CreateImageFormTests(test.ResetImageAPIVersionMixin, test.TestCase):
self.assertFalse(form.is_valid())
mock_image_list.assert_has_calls(image_calls)
@override_settings(HORIZON_IMAGES_ALLOW_UPLOAD=False)
@override_settings(IMAGES_ALLOW_LOCATION=True)
@mock.patch.object(api.glance, 'image_list_detailed')
def test_image_upload_disabled(self, mock_image_list):
mock_image_list.side_effect = [
[self.images.list(), False, False],
[self.images.list(), False, False]
]
image_calls = [
mock.call(test.IsA(dict), filters={'disk_format': 'aki'}),
mock.call(test.IsA(dict), filters={'disk_format': 'ari'})
]
form = forms.CreateImageForm({})
self.assertEqual(
isinstance(form.fields['image_file'].widget, HiddenInput), True)
source_type_dict = dict(form.fields['source_type'].choices)
self.assertNotIn('file', source_type_dict)
mock_image_list.assert_has_calls(image_calls)
@override_settings(OPENSTACK_API_VERSIONS={'image': 1})
def test_create_image_metadata_docker_v1(self):
form_data = {

View File

@ -266,11 +266,6 @@ OPENSTACK_KEYSTONE_BACKEND = {
# allowing Admin session password retrieval/decryption.
#OPENSTACK_ENABLE_PASSWORD_RETRIEVE = False
# This setting allows deployers to control whether a token is deleted on log
# out. This can be helpful when there are often long running processes being
# run in the Horizon environment.
#TOKEN_DELETION_DISABLED = False
# The Launch Instance user experience has been significantly enhanced.
# You can choose whether to enable the new launch instance experience,
# the legacy experience, or both. The legacy experience will be removed

View File

@ -309,10 +309,6 @@ USER_MENU_LINKS = [
}
]
# Deprecated Theme Settings
CUSTOM_THEME_PATH = None
DEFAULT_THEME_PATH = None
# 'key', 'label', 'path'
AVAILABLE_THEMES = [
(
@ -439,21 +435,11 @@ if STATIC_URL is None:
AVAILABLE_THEMES, SELECTABLE_THEMES, DEFAULT_THEME = (
theme_settings.get_available_themes(
AVAILABLE_THEMES,
CUSTOM_THEME_PATH,
DEFAULT_THEME_PATH,
DEFAULT_THEME,
SELECTABLE_THEMES
)
)
if CUSTOM_THEME_PATH is not None:
_LOG.warning("CUSTOM_THEME_PATH has been deprecated. Please convert "
"your settings to make use of AVAILABLE_THEMES.")
if DEFAULT_THEME_PATH is not None:
_LOG.warning("DEFAULT_THEME_PATH has been deprecated. Please convert "
"your settings to make use of AVAILABLE_THEMES.")
# Discover all the directories that contain static files
STATICFILES_DIRS = theme_settings.get_theme_static_dirs(
AVAILABLE_THEMES, THEME_COLLECTION_DIR, ROOT_PATH)
@ -516,11 +502,3 @@ if DEBUG:
# Here comes the Django settings deprecation section. Being at the very end
# of settings.py allows it to catch the settings defined in local_settings.py
# or inside one of local_settings.d/ snippets.
if 'HORIZON_IMAGES_ALLOW_UPLOAD' in globals():
message = 'The setting HORIZON_IMAGES_ALLOW_UPLOAD is deprecated in ' \
'Newton and will be removed in P release. Use the setting ' \
'HORIZON_IMAGES_UPLOAD_MODE instead.'
if not HORIZON_IMAGES_ALLOW_UPLOAD:
message += ' Keep in mind that HORIZON_IMAGES_ALLOW_UPLOAD set to ' \
'False overrides the value of HORIZON_IMAGES_UPLOAD_MODE.'
_LOG.warning(message)

View File

@ -48,8 +48,6 @@ TEMPLATES[0]['OPTIONS']['context_processors'].append(
'openstack_dashboard.context_processors.openstack'
)
CUSTOM_THEME_PATH = 'themes/default'
# 'key', 'label', 'path'
AVAILABLE_THEMES = [
(

View File

@ -17,8 +17,6 @@
import logging
import os
from django.utils.translation import pgettext_lazy
def get_theme_static_dirs(available_themes, collection_dir, root):
static_dirs = []
@ -40,64 +38,21 @@ def get_theme_static_dirs(available_themes, collection_dir, root):
return static_dirs
def get_available_themes(available_themes, custom_path, default_path,
default_theme, selectable_themes):
def get_available_themes(available_themes, default_theme, selectable_themes):
new_theme_list = []
# We can only support one path at a time, because of static file
# collection.
custom_ndx = -1
default_ndx = -1
default_theme_ndx = -1
for ndx, each_theme in enumerate(available_themes):
# Maintain Backward Compatibility for CUSTOM_THEME_PATH
if custom_path:
if each_theme[2] == custom_path:
custom_ndx = ndx
# Maintain Backward Compatibility for DEFAULT_THEME_PATH
if default_path:
if each_theme[0] == 'default':
default_ndx = ndx
each_theme = (
'default',
pgettext_lazy('Default style theme', 'Default'),
default_path
)
# Make sure that DEFAULT_THEME is configured for use
if each_theme[0] == default_theme:
default_theme_ndx = ndx
new_theme_list.append(each_theme)
if custom_ndx != -1:
# If CUSTOM_THEME_PATH is set, then we should set that as the default
# theme to make sure that upgrading Horizon doesn't jostle anyone
default_theme = available_themes[custom_ndx][0]
logging.warning("Your AVAILABLE_THEMES already contains your "
"CUSTOM_THEME_PATH, therefore using configuration in "
"AVAILABLE_THEMES for %s.", custom_path)
elif custom_path is not None:
new_theme_list.append(
('custom',
pgettext_lazy('Custom style theme', 'Custom'),
custom_path)
)
default_theme = 'custom'
# If 'default' isn't present at all, add it with the default_path
if default_ndx == -1 and default_path is not None:
new_theme_list.append(
('default',
pgettext_lazy('Default style theme', 'Default'),
default_path)
)
# If default is not configured, we have to set one,
# just grab the first theme
if default_theme_ndx == -1 and custom_ndx == -1:
if default_theme_ndx == -1:
default_theme = available_themes[0][0]
if selectable_themes is None:

View File

@ -0,0 +1,15 @@
---
upgrade:
- |
The following deprecated settings have been dropped.
* ``HORIZON_IMAGES_ALLOW_UPLOAD`` (deprecated in Newton):
Use ``HORIZON_IMAGES_UPLOAD_MODE`` instead.
* ``CUSTOM_THEME_PATH`` and ``DEFAULT_THEME_PATH``
(both deprecated in Mitaka): Use AVAILABLE_THEMES instead.
* ``OPENSTACK_TOKEN_HASH_ENABLED`` (deprecated in Mitaka):
PKI tokens currently work with hashing (before Ocata) and
Keystone already dropped PKI token support in Ocata.
* ``TOKEN_DELETION_DISABLED`` (deprecated in Ocata):
It was not marked as deprecated in the horizon documentation,
but this had no effect since Ocata release.