Merge "Define default settings explicitly (openstack_dashboard 2/5)"
This commit is contained in:
commit
b1a211479c
@ -161,7 +161,7 @@ class FlavorsViewTests(test.BaseAdminViewTests):
|
|||||||
@test.create_mocks({api.nova: ('flavor_list_paged',),
|
@test.create_mocks({api.nova: ('flavor_list_paged',),
|
||||||
flavors.Flavor: ('get_keys',), })
|
flavors.Flavor: ('get_keys',), })
|
||||||
def test_index_form_action_with_pagination(self):
|
def test_index_form_action_with_pagination(self):
|
||||||
page_size = getattr(settings, 'API_RESULT_PAGE_SIZE', 1)
|
page_size = settings.API_RESULT_PAGE_SIZE
|
||||||
flavors_list = self.flavors.list()[:2]
|
flavors_list = self.flavors.list()[:2]
|
||||||
self.mock_flavor_list_paged.side_effect = [
|
self.mock_flavor_list_paged.side_effect = [
|
||||||
(flavors_list[:page_size], False, False),
|
(flavors_list[:page_size], False, False),
|
||||||
|
@ -27,5 +27,5 @@ class AdminFloatingIps(horizon.Panel):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def can_register():
|
def can_register():
|
||||||
network_config = getattr(settings, 'OPENSTACK_NEUTRON_NETWORK', {})
|
network_config = settings.OPENSTACK_NEUTRON_NETWORK
|
||||||
return network_config.get('enable_router', True)
|
return network_config['enable_router']
|
||||||
|
@ -65,9 +65,9 @@ class IndexView(tables.DataTableView):
|
|||||||
return images
|
return images
|
||||||
filters = self.get_filters()
|
filters = self.get_filters()
|
||||||
|
|
||||||
filter_first = getattr(settings, 'FILTER_DATA_FIRST', {})
|
filter_first = settings.FILTER_DATA_FIRST
|
||||||
if filter_first.get('admin.images', False) and \
|
if (filter_first['admin.images'] and
|
||||||
len(filters) == len(self.DEFAULT_FILTERS):
|
len(filters) == len(self.DEFAULT_FILTERS)):
|
||||||
self._prev = False
|
self._prev = False
|
||||||
self._more = False
|
self._more = False
|
||||||
self._needs_filter_first = True
|
self._needs_filter_first = True
|
||||||
|
@ -187,8 +187,8 @@ class NetworkL3AgentRoutersLinkAction(tables.LinkAction):
|
|||||||
verbose_name = _("View Routers")
|
verbose_name = _("View Routers")
|
||||||
|
|
||||||
def allowed(self, request, datum):
|
def allowed(self, request, datum):
|
||||||
network_config = getattr(settings, 'OPENSTACK_NEUTRON_NETWORK', {})
|
network_config = settings.OPENSTACK_NEUTRON_NETWORK
|
||||||
if not network_config.get('enable_router', True):
|
if not network_config['enable_router']:
|
||||||
return False
|
return False
|
||||||
# Determine whether this action is allowed for the current request.
|
# Determine whether this action is allowed for the current request.
|
||||||
return datum.agent_type == "L3 agent"
|
return datum.agent_type == "L3 agent"
|
||||||
|
@ -142,8 +142,8 @@ class AdminIndexView(tables.PagedTableMixin, tables.DataTableView):
|
|||||||
# If filter_first is set and if there are not other filters
|
# If filter_first is set and if there are not other filters
|
||||||
# selected, then search criteria must be provided and return an empty
|
# selected, then search criteria must be provided and return an empty
|
||||||
# list
|
# list
|
||||||
filter_first = getattr(settings, 'FILTER_DATA_FIRST', {})
|
filter_first = settings.FILTER_DATA_FIRST
|
||||||
if (filter_first.get('admin.instances', False) and
|
if (filter_first['admin.instances'] and
|
||||||
len(search_opts) == len(default_search_opts)):
|
len(search_opts) == len(default_search_opts)):
|
||||||
self._needs_filter_first = True
|
self._needs_filter_first = True
|
||||||
self._more = False
|
self._more = False
|
||||||
|
@ -171,15 +171,14 @@ class CreateNetwork(forms.SelfHandlingForm):
|
|||||||
is_extension_supported = False
|
is_extension_supported = False
|
||||||
|
|
||||||
if is_extension_supported:
|
if is_extension_supported:
|
||||||
neutron_settings = getattr(settings,
|
neutron_settings = settings.OPENSTACK_NEUTRON_NETWORK
|
||||||
'OPENSTACK_NEUTRON_NETWORK', {})
|
|
||||||
self.seg_id_range = SEGMENTATION_ID_RANGE.copy()
|
self.seg_id_range = SEGMENTATION_ID_RANGE.copy()
|
||||||
seg_id_range = neutron_settings.get('segmentation_id_range')
|
seg_id_range = neutron_settings['segmentation_id_range']
|
||||||
if seg_id_range:
|
if seg_id_range:
|
||||||
self.seg_id_range.update(seg_id_range)
|
self.seg_id_range.update(seg_id_range)
|
||||||
|
|
||||||
self.provider_types = PROVIDER_TYPES.copy()
|
self.provider_types = PROVIDER_TYPES.copy()
|
||||||
extra_provider_types = neutron_settings.get('extra_provider_types')
|
extra_provider_types = neutron_settings['extra_provider_types']
|
||||||
if extra_provider_types:
|
if extra_provider_types:
|
||||||
self.provider_types.update(extra_provider_types)
|
self.provider_types.update(extra_provider_types)
|
||||||
|
|
||||||
@ -190,8 +189,8 @@ class CreateNetwork(forms.SelfHandlingForm):
|
|||||||
net_type for net_type in self.provider_types
|
net_type for net_type in self.provider_types
|
||||||
if self.provider_types[net_type]['require_physical_network']]
|
if self.provider_types[net_type]['require_physical_network']]
|
||||||
|
|
||||||
supported_provider_types = neutron_settings.get(
|
supported_provider_types = neutron_settings[
|
||||||
'supported_provider_types', DEFAULT_PROVIDER_TYPES)
|
'supported_provider_types']
|
||||||
if supported_provider_types == ['*']:
|
if supported_provider_types == ['*']:
|
||||||
supported_provider_types = DEFAULT_PROVIDER_TYPES
|
supported_provider_types = DEFAULT_PROVIDER_TYPES
|
||||||
|
|
||||||
@ -216,9 +215,8 @@ class CreateNetwork(forms.SelfHandlingForm):
|
|||||||
for network_type in self.nettypes_with_seg_id)
|
for network_type in self.nettypes_with_seg_id)
|
||||||
self.fields['segmentation_id'].widget.attrs.update(attrs)
|
self.fields['segmentation_id'].widget.attrs.update(attrs)
|
||||||
|
|
||||||
physical_networks = getattr(settings,
|
physical_networks = settings.OPENSTACK_NEUTRON_NETWORK[
|
||||||
'OPENSTACK_NEUTRON_NETWORK', {}
|
'physical_networks']
|
||||||
).get('physical_networks', [])
|
|
||||||
|
|
||||||
if physical_networks:
|
if physical_networks:
|
||||||
self.fields['physical_network'] = forms.ThemableChoiceField(
|
self.fields['physical_network'] = forms.ThemableChoiceField(
|
||||||
|
@ -95,9 +95,8 @@ class IndexView(tables.DataTableView):
|
|||||||
# If filter_first is set and if there are not other filters
|
# If filter_first is set and if there are not other filters
|
||||||
# selected, then search criteria must be provided and return an
|
# selected, then search criteria must be provided and return an
|
||||||
# empty list
|
# empty list
|
||||||
filter_first = getattr(settings, 'FILTER_DATA_FIRST', {})
|
filter_first = settings.FILTER_DATA_FIRST
|
||||||
if filter_first.get('admin.networks', False) and \
|
if filter_first['admin.networks'] and not search_opts:
|
||||||
not search_opts:
|
|
||||||
self._needs_filter_first = True
|
self._needs_filter_first = True
|
||||||
return []
|
return []
|
||||||
self._needs_filter_first = False
|
self._needs_filter_first = False
|
||||||
|
@ -51,7 +51,7 @@ class GlobalOverview(usage.UsageView):
|
|||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(GlobalOverview, self).get_context_data(**kwargs)
|
context = super(GlobalOverview, self).get_context_data(**kwargs)
|
||||||
context['monitoring'] = getattr(settings, 'EXTERNAL_MONITORING', [])
|
context['monitoring'] = settings.EXTERNAL_MONITORING
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def get_data(self):
|
def get_data(self):
|
||||||
|
@ -30,10 +30,10 @@ class RBACPolicies(horizon.Panel):
|
|||||||
|
|
||||||
def allowed(self, context):
|
def allowed(self, context):
|
||||||
request = context['request']
|
request = context['request']
|
||||||
network_config = getattr(settings, 'OPENSTACK_NEUTRON_NETWORK', {})
|
network_config = settings.OPENSTACK_NEUTRON_NETWORK
|
||||||
try:
|
try:
|
||||||
return (
|
return (
|
||||||
network_config.get('enable_rbac_policy', True) and
|
network_config['enable_rbac_policy'] and
|
||||||
neutron.is_extension_supported(request,
|
neutron.is_extension_supported(request,
|
||||||
extension_alias='rbac-policies')
|
extension_alias='rbac-policies')
|
||||||
)
|
)
|
||||||
|
@ -26,5 +26,5 @@ class Routers(horizon.Panel):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def can_register():
|
def can_register():
|
||||||
network_config = getattr(settings, 'OPENSTACK_NEUTRON_NETWORK', {})
|
network_config = settings.OPENSTACK_NEUTRON_NETWORK
|
||||||
return network_config.get('enable_router', True)
|
return network_config['enable_router']
|
||||||
|
@ -50,8 +50,8 @@ class IndexView(r_views.IndexView, n_views.IndexView):
|
|||||||
# If admin_filter_first is set and if there are not other filters
|
# If admin_filter_first is set and if there are not other filters
|
||||||
# selected, then search criteria must be provided and return an
|
# selected, then search criteria must be provided and return an
|
||||||
# empty list
|
# empty list
|
||||||
filter_first = getattr(settings, 'FILTER_DATA_FIRST', {})
|
filter_first = settings.FILTER_DATA_FIRST
|
||||||
if filter_first.get('admin.routers', False) and not filters:
|
if filter_first['admin.routers'] and not filters:
|
||||||
self._needs_filter_first = True
|
self._needs_filter_first = True
|
||||||
return []
|
return []
|
||||||
self._needs_filter_first = False
|
self._needs_filter_first = False
|
||||||
|
@ -51,13 +51,13 @@ class VolumesView(tables.PagedTableMixin, volumes_views.VolumeTableMixIn,
|
|||||||
default_filters = {'all_tenants': True}
|
default_filters = {'all_tenants': True}
|
||||||
|
|
||||||
filters = self.get_filters(default_filters.copy())
|
filters = self.get_filters(default_filters.copy())
|
||||||
filter_first = getattr(settings, 'FILTER_DATA_FIRST', {})
|
filter_first = settings.FILTER_DATA_FIRST
|
||||||
volumes = []
|
volumes = []
|
||||||
|
|
||||||
self.table.needs_filter_first = False
|
self.table.needs_filter_first = False
|
||||||
|
|
||||||
if filter_first.get('admin.volumes', False) and \
|
if (filter_first['admin.volumes'] and
|
||||||
len(filters) == len(default_filters):
|
len(filters) == len(default_filters)):
|
||||||
self.table.needs_filter_first = True
|
self.table.needs_filter_first = True
|
||||||
return volumes
|
return volumes
|
||||||
|
|
||||||
|
@ -54,9 +54,8 @@ class IndexView(tables.DataTableView):
|
|||||||
# If filter_first is set and if there are not other filters
|
# If filter_first is set and if there are not other filters
|
||||||
# selected, then search criteria must be provided
|
# selected, then search criteria must be provided
|
||||||
# and return an empty list
|
# and return an empty list
|
||||||
filter_first = getattr(settings, 'FILTER_DATA_FIRST', {})
|
filter_first = settings.FILTER_DATA_FIRST
|
||||||
if (filter_first.get('identity.application_credentials', False) and
|
if filter_first['identity.application_credentials'] and not filters:
|
||||||
not filters):
|
|
||||||
self._needs_filter_first = True
|
self._needs_filter_first = True
|
||||||
return app_creds
|
return app_creds
|
||||||
|
|
||||||
|
@ -53,8 +53,8 @@ class IndexView(tables.DataTableView):
|
|||||||
# If filter_first is set and if there are not other filters
|
# If filter_first is set and if there are not other filters
|
||||||
# selected, then search criteria must be provided and
|
# selected, then search criteria must be provided and
|
||||||
# return an empty list
|
# return an empty list
|
||||||
filter_first = getattr(settings, 'FILTER_DATA_FIRST', {})
|
filter_first = settings.FILTER_DATA_FIRST
|
||||||
if filter_first.get('identity.groups', False) and not filters:
|
if filter_first['identity.groups'] and not filters:
|
||||||
self._needs_filter_first = True
|
self._needs_filter_first = True
|
||||||
return groups
|
return groups
|
||||||
|
|
||||||
|
@ -95,8 +95,8 @@ class IndexView(tables.DataTableView):
|
|||||||
# If filter_first is set and if there are not other filters
|
# If filter_first is set and if there are not other filters
|
||||||
# selected, then search criteria must be provided and
|
# selected, then search criteria must be provided and
|
||||||
# return an empty list
|
# return an empty list
|
||||||
filter_first = getattr(settings, 'FILTER_DATA_FIRST', {})
|
filter_first = settings.FILTER_DATA_FIRST
|
||||||
if filter_first.get('identity.projects', False) and not filters:
|
if filter_first['identity.projects'] and not filters:
|
||||||
self._needs_filter_first = True
|
self._needs_filter_first = True
|
||||||
self._more = False
|
self._more = False
|
||||||
return tenants
|
return tenants
|
||||||
|
@ -51,8 +51,8 @@ class IndexView(tables.DataTableView):
|
|||||||
# If filter_first is set and if there are not other filters
|
# If filter_first is set and if there are not other filters
|
||||||
# selected, then search criteria must be provided
|
# selected, then search criteria must be provided
|
||||||
# and return an empty list
|
# and return an empty list
|
||||||
filter_first = getattr(settings, 'FILTER_DATA_FIRST', {})
|
filter_first = settings.FILTER_DATA_FIRST
|
||||||
if filter_first.get('identity.roles', False) and not filters:
|
if filter_first['identity.roles'] and not filters:
|
||||||
self._needs_filter_first = True
|
self._needs_filter_first = True
|
||||||
return roles
|
return roles
|
||||||
|
|
||||||
|
@ -67,8 +67,8 @@ class IndexView(tables.DataTableView):
|
|||||||
# If filter_first is set and if there are not other filters
|
# If filter_first is set and if there are not other filters
|
||||||
# selected, then search criteria must be provided
|
# selected, then search criteria must be provided
|
||||||
# and return an empty list
|
# and return an empty list
|
||||||
filter_first = getattr(settings, 'FILTER_DATA_FIRST', {})
|
filter_first = settings.FILTER_DATA_FIRST
|
||||||
if filter_first.get('identity.users', False) and not filters:
|
if filter_first['identity.users'] and not filters:
|
||||||
self._needs_filter_first = True
|
self._needs_filter_first = True
|
||||||
return users
|
return users
|
||||||
|
|
||||||
|
@ -26,6 +26,26 @@ ENABLE_CLIENT_TOKEN = True
|
|||||||
# form to verify that it is indeed the admin logged-in who wants to change
|
# form to verify that it is indeed the admin logged-in who wants to change
|
||||||
# the password.
|
# the password.
|
||||||
ENFORCE_PASSWORD_CHECK = False
|
ENFORCE_PASSWORD_CHECK = False
|
||||||
|
|
||||||
|
EXTERNAL_MONITORING = []
|
||||||
|
|
||||||
|
# To allow operators to require users provide a search criteria first
|
||||||
|
# before loading any data into the views, set the following dict
|
||||||
|
# attributes to True in each one of the panels you want to enable this feature.
|
||||||
|
# Follow the convention <dashboard>.<view>
|
||||||
|
FILTER_DATA_FIRST = {
|
||||||
|
'admin.instances': False,
|
||||||
|
'admin.images': False,
|
||||||
|
'admin.networks': False,
|
||||||
|
'admin.routers': False,
|
||||||
|
'admin.volumes': False,
|
||||||
|
'identity.application_credentials': False,
|
||||||
|
'identity.groups': False,
|
||||||
|
'identity.projects': False,
|
||||||
|
'identity.roles': False,
|
||||||
|
'identity.users': False,
|
||||||
|
}
|
||||||
|
|
||||||
# Set to 'legacy' or 'direct' to allow users to upload images to glance via
|
# Set to 'legacy' or 'direct' to allow users to upload images to glance via
|
||||||
# Horizon server. When enabled, a file form field will appear on the create
|
# Horizon server. When enabled, a file form field will appear on the create
|
||||||
# image form. If set to 'off', there will be no file form field on the create
|
# image form. If set to 'off', there will be no file form field on the create
|
||||||
@ -117,6 +137,7 @@ OPENSTACK_NEUTRON_NETWORK = {
|
|||||||
'enable_ipv6': True,
|
'enable_ipv6': True,
|
||||||
# TODO(amotoki): Change the default value to True? See local_settings.py
|
# TODO(amotoki): Change the default value to True? See local_settings.py
|
||||||
'enable_quotas': False,
|
'enable_quotas': False,
|
||||||
|
'enable_rbac_policy': True,
|
||||||
'enable_router': True,
|
'enable_router': True,
|
||||||
|
|
||||||
# Default dns servers you would like to use when a subnet is
|
# Default dns servers you would like to use when a subnet is
|
||||||
@ -129,7 +150,7 @@ OPENSTACK_NEUTRON_NETWORK = {
|
|||||||
# Set which provider network types are supported. Only the network types
|
# Set which provider network types are supported. Only the network types
|
||||||
# in this list will be available to choose from when creating a network.
|
# in this list will be available to choose from when creating a network.
|
||||||
# Network types include local, flat, vlan, gre, vxlan and geneve.
|
# Network types include local, flat, vlan, gre, vxlan and geneve.
|
||||||
# 'supported_provider_types': ['*'],
|
'supported_provider_types': ['*'],
|
||||||
|
|
||||||
# You can configure available segmentation ID range per network type
|
# You can configure available segmentation ID range per network type
|
||||||
# in your deployment.
|
# in your deployment.
|
||||||
@ -137,6 +158,7 @@ OPENSTACK_NEUTRON_NETWORK = {
|
|||||||
# 'vlan': [1024, 2048],
|
# 'vlan': [1024, 2048],
|
||||||
# 'vxlan': [4094, 65536],
|
# 'vxlan': [4094, 65536],
|
||||||
# },
|
# },
|
||||||
|
'segmentation_id_range': {},
|
||||||
|
|
||||||
# You can define additional provider network types here.
|
# You can define additional provider network types here.
|
||||||
# 'extra_provider_types': {
|
# 'extra_provider_types': {
|
||||||
@ -146,6 +168,7 @@ OPENSTACK_NEUTRON_NETWORK = {
|
|||||||
# 'require_segmentation_id': True,
|
# 'require_segmentation_id': True,
|
||||||
# }
|
# }
|
||||||
# },
|
# },
|
||||||
|
'extra_provider_types': {},
|
||||||
|
|
||||||
# Set which VNIC types are supported for port binding. Only the VNIC
|
# Set which VNIC types are supported for port binding. Only the VNIC
|
||||||
# types in this list will be available to choose from when creating a
|
# types in this list will be available to choose from when creating a
|
||||||
|
@ -272,14 +272,21 @@ OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST
|
|||||||
# services provided by neutron. Options currently available are load
|
# services provided by neutron. Options currently available are load
|
||||||
# balancer service, security groups, quotas, VPN service.
|
# balancer service, security groups, quotas, VPN service.
|
||||||
OPENSTACK_NEUTRON_NETWORK = {
|
OPENSTACK_NEUTRON_NETWORK = {
|
||||||
'enable_router': True,
|
'enable_auto_allocated_network': False,
|
||||||
|
'enable_distributed_router': False,
|
||||||
|
'enable_fip_topology_check': True,
|
||||||
|
'enable_ha_router': False,
|
||||||
|
'enable_ipv6': True,
|
||||||
# TODO(amotoki): Drop OPENSTACK_NEUTRON_NETWORK completely from here.
|
# TODO(amotoki): Drop OPENSTACK_NEUTRON_NETWORK completely from here.
|
||||||
# enable_quotas has the different default value here.
|
# enable_quotas has the different default value here.
|
||||||
'enable_quotas': True,
|
'enable_quotas': True,
|
||||||
'enable_ipv6': True,
|
'enable_rbac_policy': True,
|
||||||
'enable_distributed_router': False,
|
'enable_router': True,
|
||||||
'enable_ha_router': False,
|
|
||||||
'enable_fip_topology_check': True,
|
'default_dns_nameservers': [],
|
||||||
|
'supported_provider_types': ['*'],
|
||||||
|
'segmentation_id_range': {},
|
||||||
|
'extra_provider_types': {},
|
||||||
'supported_vnic_types': ['*'],
|
'supported_vnic_types': ['*'],
|
||||||
'physical_networks': [],
|
'physical_networks': [],
|
||||||
|
|
||||||
@ -689,22 +696,6 @@ SECURITY_GROUP_RULES = {
|
|||||||
# of data fetched by default when rendering the Overview panel.
|
# of data fetched by default when rendering the Overview panel.
|
||||||
#OVERVIEW_DAYS_RANGE = 1
|
#OVERVIEW_DAYS_RANGE = 1
|
||||||
|
|
||||||
# To allow operators to require users provide a search criteria first
|
|
||||||
# before loading any data into the views, set the following dict
|
|
||||||
# attributes to True in each one of the panels you want to enable this feature.
|
|
||||||
# Follow the convention <dashboard>.<view>
|
|
||||||
#FILTER_DATA_FIRST = {
|
|
||||||
# 'admin.instances': False,
|
|
||||||
# 'admin.images': False,
|
|
||||||
# 'admin.networks': False,
|
|
||||||
# 'admin.routers': False,
|
|
||||||
# 'admin.volumes': False,
|
|
||||||
# 'identity.users': False,
|
|
||||||
# 'identity.projects': False,
|
|
||||||
# 'identity.groups': False,
|
|
||||||
# 'identity.roles': False
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Dict used to restrict user private subnet cidr range.
|
# Dict used to restrict user private subnet cidr range.
|
||||||
# An empty list means that user input will not be restricted
|
# An empty list means that user input will not be restricted
|
||||||
# for a corresponding IP version. By default, there is
|
# for a corresponding IP version. By default, there is
|
||||||
|
Loading…
x
Reference in New Issue
Block a user