Merge "Define default settings explicitly (openstack_dashboard 5/5)"

This commit is contained in:
Zuul 2019-07-25 13:05:44 +00:00 committed by Gerrit Code Review
commit a21c22d3d0
18 changed files with 120 additions and 113 deletions

View File

@ -73,6 +73,7 @@ class PageTitleMixin(object):
def trace(name):
def decorator(func):
# TODO(amotoki): Move OPENSTACK_PROFILER setting to horizon.
if getattr(settings, 'OPENSTACK_PROFILER', {}).get('enabled', False):
return profiler.trace(name, info=None, hide_args=False,
allow_multiple_trace=True)(func)

View File

@ -50,7 +50,7 @@ def openstack(request):
request.user.authorized_tenants if tenant.enabled]
# Region context/support
available_regions = getattr(settings, 'AVAILABLE_REGIONS', [])
available_regions = settings.AVAILABLE_REGIONS
regions = {'support': len(available_regions) > 1,
'current': {'endpoint': request.session.get('region_endpoint'),
'name': request.session.get('region_name')},
@ -84,19 +84,17 @@ def openstack(request):
context['regions'] = regions
# Adding webroot access
context['WEBROOT'] = getattr(settings, "WEBROOT", "/")
context['WEBROOT'] = settings.WEBROOT
user_menu_links = getattr(settings, "USER_MENU_LINKS", [])
context['USER_MENU_LINKS'] = user_menu_links
context['USER_MENU_LINKS'] = settings.USER_MENU_LINKS
# Adding profiler support flag
profiler_settings = getattr(settings, 'OPENSTACK_PROFILER', {})
profiler_enabled = profiler_settings.get('enabled', False)
profiler_settings = settings.OPENSTACK_PROFILER
profiler_enabled = profiler_settings['enabled']
context['profiler_enabled'] = profiler_enabled
if profiler_enabled and 'profile_page' in request.COOKIES:
index_view_id = request.META.get(profiler.ROOT_HEADER, '')
hmac_keys = profiler_settings.get('keys', [])
hmac_keys = profiler_settings['keys']
context['x_trace_info'] = profiler.update_trace_headers(
hmac_keys, parent_id=index_view_id)

View File

@ -24,7 +24,7 @@ class Developer(horizon.Dashboard):
default_panel = "theme_preview"
def allowed(self, context):
if not getattr(settings, 'DEBUG', False):
if not settings.DEBUG:
return False
return super(Developer, self).allowed(context)

View File

@ -27,7 +27,7 @@ from six.moves.urllib.parse import urlparse
ROOT_HEADER = 'PARENT_VIEW_TRACE_ID'
PROFILER_SETTINGS = getattr(settings, 'OPENSTACK_PROFILER', {})
PROFILER_SETTINGS = settings.OPENSTACK_PROFILER
def init_notifier(connection_str, host="localhost"):
@ -59,8 +59,8 @@ def _get_engine_kwargs(request, connection_str):
# option
'ceilometer': lambda req: {
'endpoint': base.url_for(req, 'metering'),
'insecure': getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False),
'cacert': getattr(settings, 'OPENSTACK_SSL_CACERT', None),
'insecure': settings.OPENSTACK_SSL_NO_VERIFY,
'cacert': settings.OPENSTACK_SSL_CACERT,
'token': (lambda: req.user.token.id),
'ceilometer_api_version': '2'
}
@ -71,8 +71,7 @@ def _get_engine_kwargs(request, connection_str):
def _get_engine(request):
connection_str = PROFILER_SETTINGS.get(
'receiver_connection_string', "mongodb://")
connection_str = PROFILER_SETTINGS['receiver_connection_string']
kwargs = _get_engine_kwargs(request, connection_str)
return profiler_get_driver(connection_str, **kwargs)
@ -125,7 +124,7 @@ def update_trace_headers(keys, **kwargs):
web.X_TRACE_HMAC: trace_data[1]})
if not PROFILER_SETTINGS.get('enabled', False):
if not PROFILER_SETTINGS['enabled']:
def trace(function):
return function
else:

View File

@ -29,8 +29,8 @@ from openstack_dashboard.contrib.developer.profiler import api
_REQUIRED_KEYS = ("base_id", "hmac_key")
_OPTIONAL_KEYS = ("parent_id",)
PROFILER_CONF = getattr(settings, 'OPENSTACK_PROFILER', {})
PROFILER_ENABLED = PROFILER_CONF.get('enabled', False)
PROFILER_CONF = settings.OPENSTACK_PROFILER
PROFILER_ENABLED = PROFILER_CONF['enabled']
class ProfilerClientMiddleware(object):
@ -60,7 +60,7 @@ class ProfilerClientMiddleware(object):
return None
if 'profile_page' in request.COOKIES:
hmac_key = PROFILER_CONF.get('keys')[0]
hmac_key = PROFILER_CONF['keys'][0]
profiler.init(hmac_key)
for hdr_key, hdr_value in web.get_trace_id_headers().items():
request.META[hdr_key] = hdr_value
@ -69,11 +69,11 @@ class ProfilerClientMiddleware(object):
class ProfilerMiddleware(object):
def __init__(self, get_response):
self.name = PROFILER_CONF.get('facility_name', 'horizon')
self.hmac_keys = PROFILER_CONF.get('keys', [])
self.name = PROFILER_CONF['facility_name']
self.hmac_keys = PROFILER_CONF['keys']
self.get_response = get_response
if PROFILER_ENABLED:
api.init_notifier(PROFILER_CONF.get('notifier_connection_string'))
api.init_notifier(PROFILER_CONF['notifier_connection_string'])
else:
raise exceptions.MiddlewareNotUsed()

View File

@ -19,7 +19,7 @@ from django.utils.translation import ugettext_lazy as _
import horizon
if getattr(settings, 'OPENSTACK_PROFILER', {}).get('enabled', False):
if settings.OPENSTACK_PROFILER['enabled']:
class Profiler(horizon.Panel):
name = _("OpenStack Profiler")
slug = 'profiler'

View File

@ -30,7 +30,7 @@ from horizon.utils import functions
class UserSettingsForm(forms.SelfHandlingForm):
max_value = getattr(settings, 'API_RESULT_LIMIT', 1000)
max_value = settings.API_RESULT_LIMIT
language = forms.ChoiceField(label=_("Language"))
timezone = forms.ChoiceField(label=_("Timezone"))
pagesize = forms.IntegerField(label=_("Items Per Page"),

View File

@ -17,6 +17,32 @@ from django.utils.translation import ugettext_lazy as _
# This must be configured
# OPENSTACK_KEYSTONE_URL = 'http://localhost/identity/v3'
# WEBROOT is the location relative to Webserver root
# should end with a slash.
WEBROOT = '/'
# NOTE: The following are calculated baed on WEBROOT
# after loading local_settings
# LOGIN_URL = WEBROOT + 'auth/login/'
# LOGOUT_URL = WEBROOT + 'auth/logout/'
# LOGIN_ERROR = WEBROOT + 'auth/error/'
LOGIN_URL = None
LOGOUT_URL = None
LOGIN_ERROR = None
# NOTE: The following are calculated baed on WEBROOT
# after loading local_settings
# LOGIN_REDIRECT_URL can be used as an alternative for
# HORIZON_CONFIG.user_home, if user_home is not set.
# Do not set it to '/home/', as this will cause circular redirect loop
# LOGIN_REDIRECT_URL = WEBROOT
LOGIN_REDIRECT_URL = None
# NOTE: The following are calculated baed on WEBROOT
# after loading local_settings
MEDIA_ROOT = None
MEDIA_URL = None
STATIC_ROOT = None
STATIC_URL = None
# Dict used to restrict user private subnet cidr range.
# An empty list means that user input will not be restricted
# for a corresponding IP version. By default, there is
@ -42,6 +68,13 @@ API_RESULT_PAGE_SIZE = 20
# ]
AVAILABLE_REGIONS = []
# Modules that provide /auth routes that can be used to handle different types
# of user authentication. Add auth plugins that require extra route handling to
# this list.
AUTHENTICATION_URLS = [
'openstack_auth.urls',
]
# Set Console type:
# valid options are "AUTO"(default), "VNC", "SPICE", "RDP", "SERIAL", "MKS"
# or None. Set to None explicitly if you want to deactivate the console.
@ -61,6 +94,17 @@ CONSOLE_TYPE = "AUTO"
# }
CREATE_INSTANCE_FLAVOR_SORT = {}
# DISALLOW_IFRAME_EMBED can be used to prevent Horizon from being embedded
# within an iframe. Legacy browsers are still vulnerable to a Cross-Frame
# Scripting (XFS) vulnerability, so this option allows extra security hardening
# where iframes are not used in deployment. Default setting is True.
# For more information see:
# http://tinyurl.com/anticlickjack
DISALLOW_IFRAME_EMBED = True
# Specify a maximum number of items to display in a dropdown.
DROPDOWN_MAX_ITEMS = 30
ENABLE_CLIENT_TOKEN = True
# Set this to True to display an 'Admin Password' field on the Change Password
# form to verify that it is indeed the admin logged-in who wants to change
@ -136,10 +180,21 @@ LAUNCH_INSTANCE_DEFAULTS = {
'enable_scheduler_hints': True,
}
# The absolute path to the directory where message files are collected.
# The message file must have a .json file extension. When the user logins to
# horizon, the message files collected are processed and displayed to the user.
MESSAGES_PATH = None
OPENRC_CUSTOM_TEMPLATE = 'project/api_access/openrc.sh.template'
OPENSTACK_CLOUDS_YAML_CUSTOM_TEMPLATE = ('project/api_access/'
'clouds.yaml.template')
# The default date range in the Overview panel meters - either <today> minus N
# days (if the value is integer N), or from the beginning of the current month
# until today (if set to None). This setting should be used to limit the amount
# of data fetched by default when rendering the Overview panel.
OVERVIEW_DAYS_RANGE = 1
# Projects and users can have extra attributes as defined by keystone v3.
# Horizon has the ability to display these extra attributes via this setting.
# If you'd like to display extra data in the project or user tables, set the
@ -187,6 +242,10 @@ SHOW_OPENSTACK_CLOUDS_YAML = True
# The size of chunk in bytes for downloading objects from Swift
SWIFT_FILE_TRANSFER_CHUNK_SIZE = 512 * 1024
# NOTE: The default value of USER_MENU_LINKS will be set after loading
# local_settings if it is not configured.
USER_MENU_LINKS = None
# Overrides for OpenStack API versions. Use this setting to force the
# OpenStack dashboard to use a specific API version for a given service API.
# Versions specified here should be integers or floats, not strings.
@ -363,6 +422,14 @@ OPENSTACK_CLOUDS_YAML_NAME = 'openstack'
# If this cloud has a vendor profile in os-client-config, put it's name here.
OPENSTACK_CLOUDS_YAML_PROFILE = ''
OPENSTACK_PROFILER = {
'enabled': False,
'facility_name': 'horizon',
'keys': [],
'receiver_connection_string': "mongodb://",
'notifier_connection_string': None,
}
# AngularJS requires some settings to be made available to
# the client side. Some settings are required by in-tree / built-in horizon
# features. These settings must be added to REST_API_REQUIRED_SETTINGS in the

View File

@ -21,18 +21,6 @@ DEBUG = True
# for more information
#COMPRESS_OFFLINE = not DEBUG
# WEBROOT is the location relative to Webserver root
# should end with a slash.
WEBROOT = '/'
#LOGIN_URL = WEBROOT + 'auth/login/'
#LOGOUT_URL = WEBROOT + 'auth/logout/'
#LOGIN_ERROR = WEBROOT + 'auth/error/'
#
# LOGIN_REDIRECT_URL can be used as an alternative for
# HORIZON_CONFIG.user_home, if user_home is not set.
# Do not set it to '/home/', as this will cause circular redirect loop
#LOGIN_REDIRECT_URL = WEBROOT
# If horizon is running in production (DEBUG is False), set this
# with the list of host/domain names that the application can serve.
# For more information see:
@ -51,11 +39,6 @@ WEBROOT = '/'
#CSRF_COOKIE_SECURE = True
#SESSION_COOKIE_SECURE = True
# The absolute path to the directory where message files are collected.
# The message file must have a .json file extension. When the user logins to
# horizon, the message files collected are processed and displayed to the user.
#MESSAGES_PATH=None
# Set this to True if you want available domains displayed as a dropdown menu
# on the login screen. It is strongly advised NOT to enable this for public
# clouds, as advertising enabled domains to unauthenticated customers
@ -257,20 +240,10 @@ IMAGE_RESERVED_CUSTOM_PROPERTIES = []
# The default number of lines displayed for instance console log.
INSTANCE_LOG_LENGTH = 35
# Specify a maximum number of items to display in a dropdown.
DROPDOWN_MAX_ITEMS = 30
# The timezone of the server. This should correspond with the timezone
# of your entire OpenStack installation, and hopefully be in UTC.
TIME_ZONE = "UTC"
# Modules that provide /auth routes that can be used to handle different types
# of user authentication. Add auth plugins that require extra route handling to
# this list.
#AUTHENTICATION_URLS = [
# 'openstack_auth.urls',
#]
# The Horizon Policy Enforcement engine uses these values to load per service
# policy rule files. The content of these files should match the files the
# OpenStack services are using to determine role based access control in the
@ -561,14 +534,6 @@ SECURITY_GROUP_RULES = {
# See Metadata Definitions on:
# https://docs.openstack.org/glance/latest/user/glancemetadefcatalogapi.html
# DISALLOW_IFRAME_EMBED can be used to prevent Horizon from being embedded
# within an iframe. Legacy browsers are still vulnerable to a Cross-Frame
# Scripting (XFS) vulnerability, so this option allows extra security hardening
# where iframes are not used in deployment. Default setting is True.
# For more information see:
# http://tinyurl.com/anticlickjack
#DISALLOW_IFRAME_EMBED = True
# Help URL can be made available for the client. To provide a help URL, edit the
# following attribute to the URL of your choice.
#HORIZON_CONFIG["help_url"] = "http://openstack.mycompany.org"
@ -591,12 +556,6 @@ SECURITY_GROUP_RULES = {
# " [%(http_status)s] [%(param)s]"),
#}
# The default date range in the Overview panel meters - either <today> minus N
# days (if the value is integer N), or from the beginning of the current month
# until today (if set to None). This setting should be used to limit the amount
# of data fetched by default when rendering the Overview panel.
#OVERVIEW_DAYS_RANGE = 1
# Password will have an expiration date when using keystone v3 and enabling the
# feature.
# This setting allows you to set the number of days that the user will be alerted

View File

@ -54,15 +54,6 @@ DEBUG = False
SITE_BRANDING = 'OpenStack Dashboard'
WEBROOT = '/'
LOGIN_URL = None
LOGOUT_URL = None
LOGIN_ERROR = None
LOGIN_REDIRECT_URL = None
MEDIA_ROOT = None
MEDIA_URL = None
STATIC_ROOT = None
STATIC_URL = None
SELECTABLE_THEMES = None
INTEGRATION_TESTS_SUPPORT = False
NG_TEMPLATE_CACHE_AGE = 2592000
@ -177,7 +168,6 @@ INSTALLED_APPS = [
]
AUTHENTICATION_BACKENDS = ('openstack_auth.backend.KeystoneBackend',)
AUTHENTICATION_URLS = ['openstack_auth.urls']
AUTH_USER_MODEL = 'openstack_auth.User'
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
@ -270,10 +260,6 @@ LOCAL_PATH = None
ADD_INSTALLED_APPS = []
# 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 = [
(
@ -316,10 +302,6 @@ ANGULAR_FEATURES = {
# Notice all customizable configurations should be above this line
XSTATIC_MODULES = settings_utils.BASE_XSTATIC_MODULES
OPENSTACK_PROFILER = {
'enabled': False
}
# Load default values
# pylint: disable=wrong-import-position
from openstack_dashboard.defaults import * # noqa: F403,H303

View File

@ -29,9 +29,7 @@ def is_multi_region_configured(request):
def is_multidomain_supported():
return (keystone.VERSIONS.active >= 3 and
getattr(settings,
'OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT',
False))
settings.OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT)
@register.simple_tag(takes_context=True)
@ -80,7 +78,7 @@ def show_domain_list(context):
@register.inclusion_tag('context_selection/_project_list.html',
takes_context=True)
def show_project_list(context):
max_proj = getattr(settings, 'DROPDOWN_MAX_ITEMS', 30)
max_proj = settings.DROPDOWN_MAX_ITEMS
if 'request' not in context:
return {}
request = context['request']
@ -110,10 +108,7 @@ def show_region_list(context):
@register.inclusion_tag('context_selection/_anti_clickjack.html',
takes_context=True)
def iframe_embed_settings(context):
disallow_iframe_embed = getattr(settings,
'DISALLOW_IFRAME_EMBED',
True)
context = {'disallow_iframe_embed': disallow_iframe_embed}
context = {'disallow_iframe_embed': settings.DISALLOW_IFRAME_EMBED}
return context

View File

@ -136,7 +136,7 @@ def _apply_panel_mocks(patchers=None):
"""Global mocks on panels that get called on all views."""
if patchers is None:
patchers = {}
mocked_methods = getattr(settings, 'TEST_GLOBAL_MOCKS_ON_PANELS', {})
mocked_methods = settings.TEST_GLOBAL_MOCKS_ON_PANELS
for name, mock_config in mocked_methods.items():
method = mock_config['method']
mock_params = {}

View File

@ -31,14 +31,22 @@ monkeypatch_escape()
# Load default values
from openstack_dashboard.defaults import * # noqa: F403,H303
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
WEBROOT = '/'
# The following need to Set explicitly
# as they defaults to None in openstack_dashboard.defaults.
# TODO(amotoki): Move them to a common function.
LOGIN_URL = '/auth/login/'
LOGOUT_URL = '/auth/logout/'
LOGIN_ERROR = '/auth/error/'
LOGIN_REDIRECT_URL = '/'
MEDIA_URL = '/media/'
STATIC_URL = '/static/'
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_PATH = os.path.abspath(os.path.join(TEST_DIR, ".."))
MEDIA_ROOT = os.path.abspath(os.path.join(ROOT_PATH, '..', 'media'))
MEDIA_URL = '/media/'
STATIC_ROOT = os.path.abspath(os.path.join(ROOT_PATH, '..', 'static'))
STATIC_URL = '/static/'
WEBROOT = '/'
SECRET_KEY = secret_key.generate_or_read_from_file(
os.path.join(tempfile.gettempdir(), '.secret_key_store'))
@ -122,8 +130,6 @@ settings_utils.update_dashboards(
INSTALLED_APPS,
)
OPENSTACK_PROFILER = {'enabled': False}
settings_utils.find_static_files(HORIZON_CONFIG, AVAILABLE_THEMES,
THEME_COLLECTION_DIR, ROOT_PATH)

View File

@ -70,7 +70,7 @@ class GlanceApiTests(test.APIMockTestCase):
api_images = self.images_api.list()
expected_images = self.images.list() # Wrapped Images
filters = {}
limit = getattr(settings, 'API_RESULT_LIMIT', 1000)
limit = settings.API_RESULT_LIMIT
glanceclient = mock_glanceclient.return_value
mock_images_list = glanceclient.images.list
@ -95,7 +95,7 @@ class GlanceApiTests(test.APIMockTestCase):
api_images = self.images_api.list()
expected_images = self.images.list() # Wrapped Images
filters = {}
limit = getattr(settings, 'API_RESULT_LIMIT', 1000)
limit = settings.API_RESULT_LIMIT
sort_dir = 'asc'
sort_key = 'min_disk'
@ -125,7 +125,7 @@ class GlanceApiTests(test.APIMockTestCase):
# page_size images.
filters = {}
page_size = settings.API_RESULT_PAGE_SIZE
limit = getattr(settings, 'API_RESULT_LIMIT', 1000)
limit = settings.API_RESULT_LIMIT
api_images = self.images_api.list()
expected_images = self.images.list() # Wrapped Images
@ -165,7 +165,7 @@ class GlanceApiTests(test.APIMockTestCase):
# more, prev should return False.
filters = {}
page_size = settings.API_RESULT_PAGE_SIZE
limit = getattr(settings, 'API_RESULT_LIMIT', 1000)
limit = settings.API_RESULT_LIMIT
api_images = self.images_api.list()
expected_images = self.images.list() # Wrapped Images
@ -199,7 +199,7 @@ class GlanceApiTests(test.APIMockTestCase):
# page_size images. more, prev should return False
filters = {}
page_size = settings.API_RESULT_PAGE_SIZE
limit = getattr(settings, 'API_RESULT_LIMIT', 1000)
limit = settings.API_RESULT_LIMIT
api_images = self.images_api.list()
expected_images = self.images.list() # Wrapped Images
@ -231,7 +231,7 @@ class GlanceApiTests(test.APIMockTestCase):
# Tests getting a second page with a marker.
filters = {}
page_size = settings.API_RESULT_PAGE_SIZE
limit = getattr(settings, 'API_RESULT_LIMIT', 1000)
limit = settings.API_RESULT_LIMIT
marker = 'nonsense'
api_images = self.images_api.list()[page_size:]
@ -270,7 +270,7 @@ class GlanceApiTests(test.APIMockTestCase):
# Tests getting previous page with a marker.
filters = {}
page_size = settings.API_RESULT_PAGE_SIZE
limit = getattr(settings, 'API_RESULT_LIMIT', 1000)
limit = settings.API_RESULT_LIMIT
marker = 'nonsense'
api_images = self.images_api.list()[page_size:]
@ -317,7 +317,7 @@ class GlanceApiTests(test.APIMockTestCase):
@mock.patch.object(api.glance, 'glanceclient')
def test_metadefs_namespace_list(self, mock_glanceclient):
metadata_defs = self.metadata_defs.list()
limit = getattr(settings, 'API_RESULT_LIMIT', 1000)
limit = settings.API_RESULT_LIMIT
glanceclient = mock_glanceclient.return_value
mock_metadefs_list = glanceclient.metadefs_namespace.list
@ -340,7 +340,7 @@ class GlanceApiTests(test.APIMockTestCase):
def test_metadefs_namespace_list_with_properties_target(self,
mock_glanceclient):
metadata_defs = self.metadata_defs.list()
limit = getattr(settings, 'API_RESULT_LIMIT', 1000)
limit = settings.API_RESULT_LIMIT
filters = {'resource_types': ['OS::Cinder::Volume'],
'properties_target': 'user'}

View File

@ -186,7 +186,7 @@ class ComputeApiTests(test.APIMockTestCase):
@mock.patch.object(api._nova, 'novaclient')
def test_server_list_pagination(self, mock_novaclient):
page_size = getattr(settings, 'API_RESULT_PAGE_SIZE', 20)
page_size = settings.API_RESULT_PAGE_SIZE
servers = self.servers.list()
novaclient = mock_novaclient.return_value
self._mock_current_version(novaclient, '2.45')
@ -210,7 +210,7 @@ class ComputeApiTests(test.APIMockTestCase):
@override_settings(API_RESULT_PAGE_SIZE=1)
@mock.patch.object(api._nova, 'novaclient')
def test_server_list_pagination_more(self, mock_novaclient):
page_size = getattr(settings, 'API_RESULT_PAGE_SIZE', 1)
page_size = settings.API_RESULT_PAGE_SIZE
servers = self.servers.list()
novaclient = mock_novaclient.return_value
self._mock_current_version(novaclient, '2.45')
@ -509,7 +509,7 @@ class ComputeApiTests(test.APIMockTestCase):
@mock.patch.object(api._nova, 'novaclient')
def _test_flavor_list_paged(self, mock_novaclient,
reversed_order=False, paginate=True):
page_size = getattr(settings, 'API_RESULT_PAGE_SIZE', 20)
page_size = settings.API_RESULT_PAGE_SIZE
flavors = self.flavors.list()
order = 'asc' if reversed_order else 'desc'
novaclient = mock_novaclient.return_value
@ -534,7 +534,7 @@ class ComputeApiTests(test.APIMockTestCase):
@override_settings(API_RESULT_PAGE_SIZE=1)
@mock.patch.object(api._nova, 'novaclient')
def test_flavor_list_pagination_more_and_prev(self, mock_novaclient):
page_size = getattr(settings, 'API_RESULT_PAGE_SIZE', 1)
page_size = settings.API_RESULT_PAGE_SIZE
flavors = self.flavors.list()
marker = flavors[0].id
novaclient = mock_novaclient.return_value

View File

@ -49,7 +49,7 @@ ngdetails_url = url(r'^ngdetails/',
urlpatterns.append(ngdetails_url)
horizon.base._decorate_urlconf([ngdetails_url], require_auth)
for u in getattr(settings, 'AUTHENTICATION_URLS', ['openstack_auth.urls']):
for u in settings.AUTHENTICATION_URLS:
urlpatterns.append(url(r'^auth/', include(u)))
# Development static app and project media serving using the staticfiles app.

View File

@ -41,7 +41,7 @@ class BaseUsage(object):
@property
def first_day(self):
days_range = getattr(settings, 'OVERVIEW_DAYS_RANGE', 1)
days_range = settings.OVERVIEW_DAYS_RANGE
if days_range:
return self.today.date() - datetime.timedelta(days=days_range)
else:

View File

@ -32,7 +32,7 @@ from horizon import notifications
LOG = logging.getLogger(__name__)
MESSAGES_PATH = getattr(settings, 'MESSAGES_PATH', None)
MESSAGES_PATH = settings.MESSAGES_PATH
def get_user_home(user):