diff --git a/README.rst b/README.rst index b3abb0b..dc41df6 100644 --- a/README.rst +++ b/README.rst @@ -9,25 +9,38 @@ Setup Instructions The following should get you started:: - $ git clone https://github.com/stackforge/mistral-dashboard.git - $ cd mistral-dashboard - $ cp mistraldashboard/local/local_settings.py.example \ - mistraldashboard/local/local_settings.py + $ sudo pip install -e /opt/stack/mistral-dashboard + $ ln -s /opt/stack/mistral-dashboard/_50_mistral.py.example \ + /opt/stack/horizon/openstack_dashboard/local/enabled/_50_mistral.py -Edit the ``local_settings.py`` file as needed. Make sure you have changed -OPENSTACK_HOST to point to your keystone server and also check all endpoints -are accessible. You may want to change OPENSTACK_ENDPOINT_TYPE to "publicURL" -if some of your endpoints are inaccessible. +Since Mistral only supports Identity v3, you may need to edit the +``local_settings.py`` file to point to proper OPENSTACK_KEYSTONE_URL:: -You may also need to add a service and endpoints to keystone:: + OPENSTACK_API_VERSIONS = { + "identity": 3, + } + + OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST + +Also, make sure you have changed OPENSTACK_HOST to point to your Keystone +server and check all endpoints are accessible. You may want to change +OPENSTACK_ENDPOINT_TYPE to "publicURL" if some of them are not. + +Depending on your setup, you may also need to add a service and endpoints to +keystone:: $ MISTRAL_URL="http://[host]:[port]/v1" $ keystone service-create --name mistral --type workflow $ keystone endpoint-create --service_id mistral --publicurl $MISTRAL_URL \ --adminurl $MISTRAL_URL --internalurl $MISTRAL_URL -When you're ready to run the development server:: +When you're ready, you would need to either restart your apache:: + $ sudo service apache2 restart + +or run the development server (in case you have decided to use local horizon):: + + $ cd ../horizon/ $ tox -evenv -- python manage.py runserver diff --git a/_50_mistral.py.example b/_50_mistral.py.example new file mode 100644 index 0000000..f99a3ca --- /dev/null +++ b/_50_mistral.py.example @@ -0,0 +1,4 @@ +DASHBOARD = 'mistral' +ADD_INSTALLED_APPS = ['mistraldashboard'] +DEFAULT = True +ADD_EXCEPTIONS = {} diff --git a/mistraldashboard/dashboards/mistral/api.py b/mistraldashboard/api.py similarity index 100% rename from mistraldashboard/dashboards/mistral/api.py rename to mistraldashboard/api.py diff --git a/mistraldashboard/dashboards/mistral/dashboard.py b/mistraldashboard/dashboard.py similarity index 94% rename from mistraldashboard/dashboards/mistral/dashboard.py rename to mistraldashboard/dashboard.py index b0e34d2..ea9f1e8 100644 --- a/mistraldashboard/dashboards/mistral/dashboard.py +++ b/mistraldashboard/dashboard.py @@ -22,7 +22,7 @@ import horizon class Default(horizon.Panel): name = _("Default") slug = 'default' - urls = 'mistraldashboard.dashboards.mistral.workbooks.urls' + urls = 'mistraldashboard.workbooks.urls' nav = False diff --git a/mistraldashboard/dashboards/mistral/executions/__init__.py b/mistraldashboard/dashboards/mistral/executions/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/mistraldashboard/dashboards/mistral/workbooks/__init__.py b/mistraldashboard/dashboards/mistral/workbooks/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/mistraldashboard/dashboards/__init__.py b/mistraldashboard/executions/__init__.py similarity index 100% rename from mistraldashboard/dashboards/__init__.py rename to mistraldashboard/executions/__init__.py diff --git a/mistraldashboard/dashboards/mistral/executions/panel.py b/mistraldashboard/executions/panel.py similarity index 93% rename from mistraldashboard/dashboards/mistral/executions/panel.py rename to mistraldashboard/executions/panel.py index e42a595..35534a5 100644 --- a/mistraldashboard/dashboards/mistral/executions/panel.py +++ b/mistraldashboard/executions/panel.py @@ -17,7 +17,7 @@ from django.utils.translation import ugettext_lazy as _ import horizon -from mistraldashboard.dashboards.mistral import dashboard +from mistraldashboard import dashboard class Executions(horizon.Panel): diff --git a/mistraldashboard/dashboards/mistral/executions/tables.py b/mistraldashboard/executions/tables.py similarity index 100% rename from mistraldashboard/dashboards/mistral/executions/tables.py rename to mistraldashboard/executions/tables.py diff --git a/mistraldashboard/dashboards/mistral/executions/templates/executions/_label.html b/mistraldashboard/executions/templates/executions/_label.html similarity index 100% rename from mistraldashboard/dashboards/mistral/executions/templates/executions/_label.html rename to mistraldashboard/executions/templates/executions/_label.html diff --git a/mistraldashboard/dashboards/mistral/executions/templates/executions/index.html b/mistraldashboard/executions/templates/executions/index.html similarity index 100% rename from mistraldashboard/dashboards/mistral/executions/templates/executions/index.html rename to mistraldashboard/executions/templates/executions/index.html diff --git a/mistraldashboard/dashboards/mistral/executions/urls.py b/mistraldashboard/executions/urls.py similarity index 85% rename from mistraldashboard/dashboards/mistral/executions/urls.py rename to mistraldashboard/executions/urls.py index 8d9b875..abc751a 100644 --- a/mistraldashboard/dashboards/mistral/executions/urls.py +++ b/mistraldashboard/executions/urls.py @@ -17,8 +17,8 @@ from django.conf.urls import patterns # noqa from django.conf.urls import url # noqa -from mistraldashboard.dashboards.mistral.executions.views import IndexView -from mistraldashboard.dashboards.mistral.executions.views import TaskView +from mistraldashboard.executions.views import IndexView +from mistraldashboard.executions.views import TaskView EXECUTIONS = r'^(?P[^/]+)/%s$' diff --git a/mistraldashboard/dashboards/mistral/executions/views.py b/mistraldashboard/executions/views.py similarity index 86% rename from mistraldashboard/dashboards/mistral/executions/views.py rename to mistraldashboard/executions/views.py index f8ecc5f..003707e 100644 --- a/mistraldashboard/dashboards/mistral/executions/views.py +++ b/mistraldashboard/executions/views.py @@ -16,10 +16,9 @@ from horizon import tables -from mistraldashboard.dashboards.mistral import api -from mistraldashboard.dashboards.mistral.executions.tables \ - import ExecutionsTable -from mistraldashboard.dashboards.mistral.executions.tables import TaskTable +from mistraldashboard import api +from mistraldashboard.executions.tables import ExecutionsTable +from mistraldashboard.executions.tables import TaskTable class IndexView(tables.DataTableView): diff --git a/mistraldashboard/local/__init__.py b/mistraldashboard/local/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/mistraldashboard/local/local_settings.py.example b/mistraldashboard/local/local_settings.py.example deleted file mode 100644 index d9960d0..0000000 --- a/mistraldashboard/local/local_settings.py.example +++ /dev/null @@ -1,488 +0,0 @@ -import os - -from django.utils.translation import ugettext_lazy as _ - -from openstack_dashboard import exceptions - -DEBUG = True -TEMPLATE_DEBUG = DEBUG - -# Required for Django 1.5. -# 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: -# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts -#ALLOWED_HOSTS = ['horizon.example.com', ] - -# Set SSL proxy settings: -# For Django 1.4+ pass this header from the proxy after terminating the SSL, -# and don't forget to strip it from the client's request. -# For more information see: -# https://docs.djangoproject.com/en/1.4/ref/settings/#secure-proxy-ssl-header -# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https') - -# If Horizon is being served through SSL, then uncomment the following two -# settings to better secure the cookies from security exploits -#CSRF_COOKIE_SECURE = True -#SESSION_COOKIE_SECURE = True - -# Overrides for OpenStack API versions. Use this setting to force the -# OpenStack dashboard to use a specific API version for a given service API. -# NOTE: The version should be formatted as it appears in the URL for the -# service API. For example, The identity service APIs have inconsistent -# use of the decimal point, so valid options would be "2.0" or "3". -# OPENSTACK_API_VERSIONS = { -# "identity": 3, -# "volume": 2 -# } - -# Set this to True if running on multi-domain model. When this is enabled, it -# will require user to enter the Domain name in addition to username for login. -# OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = False - -# Overrides the default domain used when running on single-domain model -# with Keystone V3. All entities will be created in the default domain. -# OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = 'Default' - -# Set Console type: -# valid options would be "AUTO", "VNC", "SPICE" or "RDP" -# CONSOLE_TYPE = "AUTO" - -# Default OpenStack Dashboard configuration. -HORIZON_CONFIG = { - 'dashboards': ('project', 'admin', 'settings',), - 'default_dashboard': 'project', - 'user_home': 'openstack_dashboard.views.get_user_home', - 'ajax_queue_limit': 10, - 'auto_fade_alerts': { - 'delay': 3000, - 'fade_duration': 1500, - 'types': ['alert-success', 'alert-info'] - }, - 'help_url': "http://docs.openstack.org", - 'exceptions': {'recoverable': exceptions.RECOVERABLE, - 'not_found': exceptions.NOT_FOUND, - 'unauthorized': exceptions.UNAUTHORIZED}, -} - -# Specify a regular expression to validate user passwords. -# HORIZON_CONFIG["password_validator"] = { -# "regex": '.*', -# "help_text": _("Your password does not meet the requirements.") -# } - -# Disable simplified floating IP address management for deployments with -# multiple floating IP pools or complex network requirements. -# HORIZON_CONFIG["simple_ip_management"] = False - -# Turn off browser autocompletion for the login form if so desired. -# HORIZON_CONFIG["password_autocomplete"] = "off" - -LOCAL_PATH = os.path.dirname(os.path.abspath(__file__)) - -# Set custom secret key: -# You can either set it to a specific value or you can let horizion generate a -# default secret key that is unique on this machine, e.i. regardless of the -# amount of Python WSGI workers (if used behind Apache+mod_wsgi): However, -# there may be situations where you would want to set this explicitly, e.g. -# when multiple dashboard instances are distributed on different machines -# (usually behind a load-balancer). Either you have to make sure that a session -# gets all requests routed to the same dashboard instance or you set the same -# SECRET_KEY for all of them. -from horizon.utils import secret_key -SECRET_KEY = secret_key.generate_or_read_from_file( - os.path.join(LOCAL_PATH, '.secret_key_store')) - -# We recommend you use memcached for development; otherwise after every reload -# of the django development server, you will have to login again. To use -# memcached set CACHES to something like -# CACHES = { -# 'default': { -# 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', -# 'LOCATION': '127.0.0.1:11211', -# } -#} - -CACHES = { - 'default': { - 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache' - } -} - -# Send email to the console by default -EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' -# Or send them to /dev/null -#EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend' - -# Configure these for your outgoing email host -# EMAIL_HOST = 'smtp.my-company.com' -# EMAIL_PORT = 25 -# EMAIL_HOST_USER = 'djangomail' -# EMAIL_HOST_PASSWORD = 'top-secret!' - -# For multiple regions uncomment this configuration, and add (endpoint, title). -# AVAILABLE_REGIONS = [ -# ('http://cluster1.example.com:5000/v2.0', 'cluster1'), -# ('http://cluster2.example.com:5000/v2.0', 'cluster2'), -# ] - -OPENSTACK_HOST = "172.16.80.200" -OPENSTACK_KEYSTONE_URL = "http://%s:5000/v2.0" % OPENSTACK_HOST -OPENSTACK_KEYSTONE_DEFAULT_ROLE = "_member_" - -# Disable SSL certificate checks (useful for self-signed certificates): -# OPENSTACK_SSL_NO_VERIFY = True - -# The CA certificate to use to verify SSL connections -# OPENSTACK_SSL_CACERT = '/path/to/cacert.pem' - -# The OPENSTACK_KEYSTONE_BACKEND settings can be used to identify the -# capabilities of the auth backend for Keystone. -# If Keystone has been configured to use LDAP as the auth backend then set -# can_edit_user to False and name to 'ldap'. -# -# TODO(tres): Remove these once Keystone has an API to identify auth backend. -OPENSTACK_KEYSTONE_BACKEND = { - 'name': 'native', - 'can_edit_user': True, - 'can_edit_group': True, - 'can_edit_project': True, - 'can_edit_domain': True, - 'can_edit_role': True -} - -#Setting this to True, will add a new "Retrieve Password" action on instance, -#allowing Admin session password retrieval/decryption. -#OPENSTACK_ENABLE_PASSWORD_RETRIEVE = False - -# The Xen Hypervisor has the ability to set the mount point for volumes -# attached to instances (other Hypervisors currently do not). Setting -# can_set_mount_point to True will add the option to set the mount point -# from the UI. -OPENSTACK_HYPERVISOR_FEATURES = { - 'can_set_mount_point': False, - 'can_set_password': False, -} - -# The OPENSTACK_NEUTRON_NETWORK settings can be used to enable optional -# services provided by neutron. Options currently available are load -# balancer service, security groups, quotas, VPN service. -OPENSTACK_NEUTRON_NETWORK = { - 'enable_lb': False, - 'enable_firewall': False, - 'enable_quotas': True, - 'enable_vpn': False, - # The profile_support option is used to detect if an external router can be - # configured via the dashboard. When using specific plugins the - # profile_support can be turned on if needed. - 'profile_support': None, - #'profile_support': 'cisco', -} - -# The OPENSTACK_IMAGE_BACKEND settings can be used to customize features -# in the OpenStack Dashboard related to the Image service, such as the list -# of supported image formats. -# OPENSTACK_IMAGE_BACKEND = { -# 'image_formats': [ -# ('', ''), -# ('aki', _('AKI - Amazon Kernel Image')), -# ('ami', _('AMI - Amazon Machine Image')), -# ('ari', _('ARI - Amazon Ramdisk Image')), -# ('iso', _('ISO - Optical Disk Image')), -# ('qcow2', _('QCOW2 - QEMU Emulator')), -# ('raw', _('Raw')), -# ('vdi', _('VDI')), -# ('vhd', _('VHD')), -# ('vmdk', _('VMDK')) -# ] -# } - -# The IMAGE_CUSTOM_PROPERTY_TITLES settings is used to customize the titles for -# image custom property attributes that appear on image detail pages. -IMAGE_CUSTOM_PROPERTY_TITLES = { - "architecture": _("Architecture"), - "kernel_id": _("Kernel ID"), - "ramdisk_id": _("Ramdisk ID"), - "image_state": _("Euca2ools state"), - "project_id": _("Project ID"), - "image_type": _("Image Type") -} - -# OPENSTACK_ENDPOINT_TYPE specifies the endpoint type to use for the endpoints -# in the Keystone service catalog. Use this setting when Horizon is running -# external to the OpenStack environment. The default is 'publicURL'. -#OPENSTACK_ENDPOINT_TYPE = "publicURL" - -# SECONDARY_ENDPOINT_TYPE specifies the fallback endpoint type to use in the -# case that OPENSTACK_ENDPOINT_TYPE is not present in the endpoints -# in the Keystone service catalog. Use this setting when Horizon is running -# external to the OpenStack environment. The default is None. This -# value should differ from OPENSTACK_ENDPOINT_TYPE if used. -#SECONDARY_ENDPOINT_TYPE = "publicURL" - -# The number of objects (Swift containers/objects or images) to display -# on a single page before providing a paging element (a "more" link) -# to paginate results. -API_RESULT_LIMIT = 1000 -API_RESULT_PAGE_SIZE = 20 - -# The timezone of the server. This should correspond with the timezone -# of your entire OpenStack installation, and hopefully be in UTC. -TIME_ZONE = "UTC" - -# When launching an instance, the menu of available flavors is -# sorted by RAM usage, ascending. If you would like a different sort order, -# you can provide another flavor attribute as sorting key. Alternatively, you -# can provide a custom callback method to use for sorting. You can also provide -# a flag for reverse sort. For more info, see -# http://docs.python.org/2/library/functions.html#sorted -# CREATE_INSTANCE_FLAVOR_SORT = { -# 'key': 'name', -# # or -# 'key': my_awesome_callback_method, -# 'reverse': False, -# } - -# 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 -# target installation. - -# Path to directory containing policy.json files -#POLICY_FILES_PATH = os.path.join(ROOT_PATH, "conf") -# Map of local copy of service policy files -#POLICY_FILES = { -# 'identity': 'keystone_policy.json', -# 'compute': 'nova_policy.json' -#} - -# Trove user and database extension support. By default support for -# creating users and databases on database instances is turned on. -# To disable these extensions set the permission here to something -# unusable such as ["!"]. -# TROVE_ADD_USER_PERMS = [] -# TROVE_ADD_DATABASE_PERMS = [] - -LOGGING = { - 'version': 1, - # When set to True this will disable all logging except - # for loggers specified in this configuration dictionary. Note that - # if nothing is specified here and disable_existing_loggers is True, - # django.db.backends will still log unless it is disabled explicitly. - 'disable_existing_loggers': False, - 'handlers': { - 'null': { - 'level': 'DEBUG', - 'class': 'django.utils.log.NullHandler', - }, - 'console': { - # Set the level to "DEBUG" for verbose output logging. - 'level': 'INFO', - 'class': 'logging.StreamHandler', - }, - }, - 'loggers': { - # Logging from django.db.backends is VERY verbose, send to null - # by default. - 'django.db.backends': { - 'handlers': ['null'], - 'propagate': False, - }, - 'requests': { - 'handlers': ['null'], - 'propagate': False, - }, - 'horizon': { - 'handlers': ['console'], - 'level': 'DEBUG', - 'propagate': False, - }, - 'openstack_dashboard': { - 'handlers': ['console'], - 'level': 'DEBUG', - 'propagate': False, - }, - 'novaclient': { - 'handlers': ['console'], - 'level': 'DEBUG', - 'propagate': False, - }, - 'cinderclient': { - 'handlers': ['console'], - 'level': 'DEBUG', - 'propagate': False, - }, - 'keystoneclient': { - 'handlers': ['console'], - 'level': 'DEBUG', - 'propagate': False, - }, - 'glanceclient': { - 'handlers': ['console'], - 'level': 'DEBUG', - 'propagate': False, - }, - 'neutronclient': { - 'handlers': ['console'], - 'level': 'DEBUG', - 'propagate': False, - }, - 'heatclient': { - 'handlers': ['console'], - 'level': 'DEBUG', - 'propagate': False, - }, - 'ceilometerclient': { - 'handlers': ['console'], - 'level': 'DEBUG', - 'propagate': False, - }, - 'troveclient': { - 'handlers': ['console'], - 'level': 'DEBUG', - 'propagate': False, - }, - 'swiftclient': { - 'handlers': ['console'], - 'level': 'DEBUG', - 'propagate': False, - }, - 'openstack_auth': { - 'handlers': ['console'], - 'level': 'DEBUG', - 'propagate': False, - }, - 'nose.plugins.manager': { - 'handlers': ['console'], - 'level': 'DEBUG', - 'propagate': False, - }, - 'django': { - 'handlers': ['console'], - 'level': 'DEBUG', - 'propagate': False, - }, - 'iso8601': { - 'handlers': ['null'], - 'propagate': False, - }, - } -} - -# 'direction' should not be specified for all_tcp/udp/icmp. -# It is specified in the form. -SECURITY_GROUP_RULES = { - 'all_tcp': { - 'name': 'ALL TCP', - 'ip_protocol': 'tcp', - 'from_port': '1', - 'to_port': '65535', - }, - 'all_udp': { - 'name': 'ALL UDP', - 'ip_protocol': 'udp', - 'from_port': '1', - 'to_port': '65535', - }, - 'all_icmp': { - 'name': 'ALL ICMP', - 'ip_protocol': 'icmp', - 'from_port': '-1', - 'to_port': '-1', - }, - 'ssh': { - 'name': 'SSH', - 'ip_protocol': 'tcp', - 'from_port': '22', - 'to_port': '22', - }, - 'smtp': { - 'name': 'SMTP', - 'ip_protocol': 'tcp', - 'from_port': '25', - 'to_port': '25', - }, - 'dns': { - 'name': 'DNS', - 'ip_protocol': 'tcp', - 'from_port': '53', - 'to_port': '53', - }, - 'http': { - 'name': 'HTTP', - 'ip_protocol': 'tcp', - 'from_port': '80', - 'to_port': '80', - }, - 'pop3': { - 'name': 'POP3', - 'ip_protocol': 'tcp', - 'from_port': '110', - 'to_port': '110', - }, - 'imap': { - 'name': 'IMAP', - 'ip_protocol': 'tcp', - 'from_port': '143', - 'to_port': '143', - }, - 'ldap': { - 'name': 'LDAP', - 'ip_protocol': 'tcp', - 'from_port': '389', - 'to_port': '389', - }, - 'https': { - 'name': 'HTTPS', - 'ip_protocol': 'tcp', - 'from_port': '443', - 'to_port': '443', - }, - 'smtps': { - 'name': 'SMTPS', - 'ip_protocol': 'tcp', - 'from_port': '465', - 'to_port': '465', - }, - 'imaps': { - 'name': 'IMAPS', - 'ip_protocol': 'tcp', - 'from_port': '993', - 'to_port': '993', - }, - 'pop3s': { - 'name': 'POP3S', - 'ip_protocol': 'tcp', - 'from_port': '995', - 'to_port': '995', - }, - 'ms_sql': { - 'name': 'MS SQL', - 'ip_protocol': 'tcp', - 'from_port': '1433', - 'to_port': '1433', - }, - 'mysql': { - 'name': 'MYSQL', - 'ip_protocol': 'tcp', - 'from_port': '3306', - 'to_port': '3306', - }, - 'rdp': { - 'name': 'RDP', - 'ip_protocol': 'tcp', - 'from_port': '3389', - 'to_port': '3389', - }, -} - -FLAVOR_EXTRA_KEYS = { - 'flavor_keys': [ - ('quota:read_bytes_sec', _('Quota: Read bytes')), - ('quota:write_bytes_sec', _('Quota: Write bytes')), - ('quota:cpu_quota', _('Quota: CPU')), - ('quota:cpu_period', _('Quota: CPU period')), - ('quota:inbound_average', _('Quota: Inbound average')), - ('quota:outbound_average', _('Quota: Outbound average')), - ] -} diff --git a/mistraldashboard/models.py b/mistraldashboard/models.py deleted file mode 100644 index 1b3d5f9..0000000 --- a/mistraldashboard/models.py +++ /dev/null @@ -1,3 +0,0 @@ -""" -Stub file to work around django bug: https://code.djangoproject.com/ticket/7198 -""" diff --git a/mistraldashboard/settings.py b/mistraldashboard/settings.py deleted file mode 100644 index aeadbac..0000000 --- a/mistraldashboard/settings.py +++ /dev/null @@ -1,263 +0,0 @@ -# Copyright 2012 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# All Rights Reserved. -# -# Copyright 2012 Nebula, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import logging -import os -import sys -import warnings - -from django.utils.translation import ugettext_lazy as _ - -from openstack_dashboard import exceptions - -warnings.formatwarning = lambda message, category, *args, **kwargs: \ - '%s: %s' % (category.__name__, message) - -ROOT_PATH = os.path.dirname(os.path.abspath(__file__)) -BIN_DIR = os.path.abspath(os.path.join(ROOT_PATH, '..', 'bin')) - -if ROOT_PATH not in sys.path: - sys.path.append(ROOT_PATH) - -DEBUG = False -TEMPLATE_DEBUG = DEBUG - -SITE_BRANDING = 'OpenStack Dashboard' - -LOGIN_URL = '/auth/login/' -LOGOUT_URL = '/auth/logout/' -# 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 = '/' - -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/' - -ROOT_URLCONF = 'openstack_dashboard.urls' - -HORIZON_CONFIG = { - 'dashboards': ('project', 'admin', 'mistral', - 'settings', 'router',), - 'default_dashboard': 'project', - 'user_home': 'openstack_dashboard.views.get_user_home', - 'ajax_queue_limit': 10, - 'auto_fade_alerts': { - 'delay': 3000, - 'fade_duration': 1500, - 'types': ['alert-success', 'alert-info'] - }, - 'help_url': "http://docs.openstack.org", - 'exceptions': {'recoverable': exceptions.RECOVERABLE, - 'not_found': exceptions.NOT_FOUND, - 'unauthorized': exceptions.UNAUTHORIZED}, -} - -# Set to True to allow users to upload images to glance via Horizon server. -# When enabled, a file form field will appear on the create image form. -# See documentation for deployment considerations. -HORIZON_IMAGES_ALLOW_UPLOAD = True - -# The OPENSTACK_IMAGE_BACKEND settings can be used to customize features -# in the OpenStack Dashboard related to the Image service, such as the list -# of supported image formats. -OPENSTACK_IMAGE_BACKEND = { - 'image_formats': [ - ('', ''), - ('aki', _('AKI - Amazon Kernel Image')), - ('ami', _('AMI - Amazon Machine Image')), - ('ari', _('ARI - Amazon Ramdisk Image')), - ('iso', _('ISO - Optical Disk Image')), - ('qcow2', _('QCOW2 - QEMU Emulator')), - ('raw', _('Raw')), - ('vdi', _('VDI')), - ('vhd', _('VHD')), - ('vmdk', _('VMDK')) - ] -} - -MIDDLEWARE_CLASSES = ( - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'horizon.middleware.HorizonMiddleware', - 'django.middleware.doc.XViewMiddleware', - 'django.middleware.locale.LocaleMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', -) - -TEMPLATE_CONTEXT_PROCESSORS = ( - 'django.core.context_processors.debug', - 'django.core.context_processors.i18n', - 'django.core.context_processors.request', - 'django.core.context_processors.media', - 'django.core.context_processors.static', - 'django.contrib.messages.context_processors.messages', - 'horizon.context_processors.horizon', - 'openstack_dashboard.context_processors.openstack', -) - -TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', - 'horizon.loaders.TemplateLoader' -) - -TEMPLATE_DIRS = ( - os.path.join(ROOT_PATH, 'templates'), -) - -STATICFILES_FINDERS = ( - 'compressor.finders.CompressorFinder', - 'django.contrib.staticfiles.finders.AppDirectoriesFinder', -) - -COMPRESS_PRECOMPILERS = ( - ('text/less', ('lesscpy {infile}')), -) - -COMPRESS_CSS_FILTERS = ( - 'compressor.filters.css_default.CssAbsoluteFilter', -) - -COMPRESS_ENABLED = True -COMPRESS_OUTPUT_DIR = 'dashboard' -COMPRESS_CSS_HASHING_METHOD = 'hash' -COMPRESS_PARSER = 'compressor.parser.HtmlParser' - -INSTALLED_APPS = [ - 'openstack_dashboard', - 'django.contrib.contenttypes', - 'django.contrib.auth', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'django.contrib.humanize', - 'compressor', - 'horizon', - 'openstack_auth', - 'mistraldashboard.dashboards.mistral' -] - -TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' -AUTHENTICATION_BACKENDS = ('openstack_auth.backend.KeystoneBackend',) -MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage' - -SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies' -SESSION_COOKIE_HTTPONLY = True -SESSION_EXPIRE_AT_BROWSER_CLOSE = True -SESSION_COOKIE_SECURE = False -SESSION_TIMEOUT = 1800 - -# When using cookie-based sessions, log error when the session cookie exceeds -# the following size (common browsers drop cookies above a certain size): -SESSION_COOKIE_MAX_SIZE = 4093 - -# when doing upgrades, it may be wise to stick to PickleSerializer -# TODO(mrunge): remove after Icehouse -SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer' - -LANGUAGES = ( - ('de', 'German'), - ('en', 'English'), - ('en-au', 'Australian English'), - ('en-gb', 'British English'), - ('es', 'Spanish'), - ('fr', 'French'), - ('hi', 'Hindi'), - ('ja', 'Japanese'), - ('ko', 'Korean (Korea)'), - ('nl', 'Dutch (Netherlands)'), - ('pl', 'Polish'), - ('pt-br', 'Portuguese (Brazil)'), - ('sr', 'Serbian'), - ('zh-cn', 'Simplified Chinese'), - ('zh-tw', 'Chinese (Taiwan)'), -) -LANGUAGE_CODE = 'en' -LANGUAGE_COOKIE_NAME = 'horizon_language' -USE_I18N = True -USE_L10N = True -USE_TZ = True - -OPENSTACK_KEYSTONE_DEFAULT_ROLE = '_member_' - -DEFAULT_EXCEPTION_REPORTER_FILTER = 'horizon.exceptions.HorizonReporterFilter' - -POLICY_FILES_PATH = os.path.join(ROOT_PATH, "conf") -# Map of local copy of service policy files -POLICY_FILES = { - 'identity': 'keystone_policy.json', - 'compute': 'nova_policy.json', - 'volume': 'cinder_policy.json', - 'image': 'glance_policy.json', -} - -SECRET_KEY = None -LOCAL_PATH = None - -try: - from local.local_settings import * # noqa -except ImportError: - logging.warning("No local_settings file found.") - -# Load the pluggable dashboard settings -import openstack_dashboard.enabled -import openstack_dashboard.local.enabled -from openstack_dashboard.utils import settings - -INSTALLED_APPS = list(INSTALLED_APPS) # Make sure it's mutable -settings.update_dashboards([ - openstack_dashboard.enabled, - openstack_dashboard.local.enabled, -], HORIZON_CONFIG, INSTALLED_APPS) - -# Ensure that we always have a SECRET_KEY set, even when no local_settings.py -# file is present. See local_settings.py.example for full documentation on the -# horizon.utils.secret_key module and its use. -if not SECRET_KEY: - if not LOCAL_PATH: - LOCAL_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), - 'local') - - from horizon.utils import secret_key - SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH, - '.secret_key_store')) - -from openstack_dashboard import policy -POLICY_CHECK_FUNCTION = policy.check - -# Add HORIZON_CONFIG to the context information for offline compression -COMPRESS_OFFLINE_CONTEXT = { - 'STATIC_URL': STATIC_URL, - 'HORIZON_CONFIG': HORIZON_CONFIG -} - -if DEBUG: - logging.basicConfig(level=logging.DEBUG) - -# during django reloads and an active user is logged in, the monkey -# patch below will not otherwise be applied in time - resulting in developers -# appearing to be logged out. In typical production deployments this section -# below may be ommited, though it should not be harmful -from openstack_auth import utils as auth_utils -auth_utils.patch_middleware_get_user() diff --git a/mistraldashboard/dashboards/mistral/__init__.py b/mistraldashboard/workbooks/__init__.py similarity index 100% rename from mistraldashboard/dashboards/mistral/__init__.py rename to mistraldashboard/workbooks/__init__.py diff --git a/mistraldashboard/dashboards/mistral/workbooks/forms.py b/mistraldashboard/workbooks/forms.py similarity index 97% rename from mistraldashboard/dashboards/mistral/workbooks/forms.py rename to mistraldashboard/workbooks/forms.py index 5e4a261..a65c3a9 100644 --- a/mistraldashboard/dashboards/mistral/workbooks/forms.py +++ b/mistraldashboard/workbooks/forms.py @@ -22,7 +22,7 @@ from horizon import exceptions from horizon import forms from horizon import messages -from mistraldashboard.dashboards.mistral import api +from mistraldashboard import api class ExecuteForm(forms.SelfHandlingForm): diff --git a/mistraldashboard/dashboards/mistral/workbooks/panel.py b/mistraldashboard/workbooks/panel.py similarity index 93% rename from mistraldashboard/dashboards/mistral/workbooks/panel.py rename to mistraldashboard/workbooks/panel.py index 9065a57..3077aef 100644 --- a/mistraldashboard/dashboards/mistral/workbooks/panel.py +++ b/mistraldashboard/workbooks/panel.py @@ -18,7 +18,7 @@ from django.utils.translation import ugettext_lazy as _ import horizon -from mistraldashboard.dashboards.mistral import dashboard +from mistraldashboard import dashboard class Workbooks(horizon.Panel): diff --git a/mistraldashboard/dashboards/mistral/workbooks/tables.py b/mistraldashboard/workbooks/tables.py similarity index 100% rename from mistraldashboard/dashboards/mistral/workbooks/tables.py rename to mistraldashboard/workbooks/tables.py diff --git a/mistraldashboard/dashboards/mistral/workbooks/templates/workbooks/_execute.html b/mistraldashboard/workbooks/templates/workbooks/_execute.html similarity index 100% rename from mistraldashboard/dashboards/mistral/workbooks/templates/workbooks/_execute.html rename to mistraldashboard/workbooks/templates/workbooks/_execute.html diff --git a/mistraldashboard/dashboards/mistral/workbooks/templates/workbooks/execute.html b/mistraldashboard/workbooks/templates/workbooks/execute.html similarity index 100% rename from mistraldashboard/dashboards/mistral/workbooks/templates/workbooks/execute.html rename to mistraldashboard/workbooks/templates/workbooks/execute.html diff --git a/mistraldashboard/dashboards/mistral/workbooks/templates/workbooks/index.html b/mistraldashboard/workbooks/templates/workbooks/index.html similarity index 100% rename from mistraldashboard/dashboards/mistral/workbooks/templates/workbooks/index.html rename to mistraldashboard/workbooks/templates/workbooks/index.html diff --git a/mistraldashboard/dashboards/mistral/workbooks/urls.py b/mistraldashboard/workbooks/urls.py similarity index 85% rename from mistraldashboard/dashboards/mistral/workbooks/urls.py rename to mistraldashboard/workbooks/urls.py index a262a40..d26a62c 100644 --- a/mistraldashboard/dashboards/mistral/workbooks/urls.py +++ b/mistraldashboard/workbooks/urls.py @@ -17,8 +17,8 @@ from django.conf.urls import patterns # noqa from django.conf.urls import url # noqa -from mistraldashboard.dashboards.mistral.workbooks.views import IndexView -from mistraldashboard.dashboards.mistral.workbooks.views import ExecuteView +from mistraldashboard.workbooks.views import IndexView +from mistraldashboard.workbooks.views import ExecuteView WORKBOOKS = r'^(?P[^/]+)/%s$' diff --git a/mistraldashboard/dashboards/mistral/workbooks/views.py b/mistraldashboard/workbooks/views.py similarity index 87% rename from mistraldashboard/dashboards/mistral/workbooks/views.py rename to mistraldashboard/workbooks/views.py index 71f1840..f6bfdba 100644 --- a/mistraldashboard/dashboards/mistral/workbooks/views.py +++ b/mistraldashboard/workbooks/views.py @@ -19,9 +19,9 @@ from django.core.urlresolvers import reverse_lazy from horizon import tables from horizon import forms -from mistraldashboard.dashboards.mistral import api -from mistraldashboard.dashboards.mistral.workbooks.tables import WorkbooksTable -from mistraldashboard.dashboards.mistral.workbooks.forms import ExecuteForm +from mistraldashboard import api +from mistraldashboard.workbooks.tables import WorkbooksTable +from mistraldashboard.workbooks.forms import ExecuteForm class IndexView(tables.DataTableView): diff --git a/requirements.txt b/requirements.txt index 16f9b48..ea1ca41 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ --e git+https://github.com/openstack/horizon.git#egg=horizon -e git+https://github.com/stackforge/python-mistralclient.git#egg=python-mistralclient PyYAML>=3.1.0 \ No newline at end of file