Update horizon after working with it at yahoo
This commit is contained in:
parent
1f55994a15
commit
f2f6bbd521
@ -16,11 +16,6 @@
|
|||||||
|
|
||||||
import io
|
import io
|
||||||
|
|
||||||
try:
|
|
||||||
from collections import OrderedDict
|
|
||||||
except ImportError:
|
|
||||||
from ordereddict import OrderedDict
|
|
||||||
|
|
||||||
from anvil import cfg
|
from anvil import cfg
|
||||||
from anvil import colorizer
|
from anvil import colorizer
|
||||||
from anvil import components as comp
|
from anvil import components as comp
|
||||||
@ -28,6 +23,8 @@ from anvil import log as logging
|
|||||||
from anvil import shell as sh
|
from anvil import shell as sh
|
||||||
from anvil import utils
|
from anvil import utils
|
||||||
|
|
||||||
|
from anvil.utils import OrderedDict
|
||||||
|
|
||||||
from anvil.components.helpers import db as dbhelper
|
from anvil.components.helpers import db as dbhelper
|
||||||
from anvil.components.helpers import glance as ghelper
|
from anvil.components.helpers import glance as ghelper
|
||||||
from anvil.components.helpers import keystone as khelper
|
from anvil.components.helpers import keystone as khelper
|
||||||
|
@ -26,35 +26,25 @@ from anvil.packaging import yum
|
|||||||
|
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
|
|
||||||
|
import binascii
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from anvil.components.helpers import db as dbhelper
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
# Actual dir names
|
# See https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-SECRET_KEY
|
||||||
ROOT_HORIZON = 'horizon'
|
#
|
||||||
ROOT_DASH = 'openstack_dashboard'
|
# Needs to be a multiple of 2 for our usage...
|
||||||
|
SECRET_KEY_LEN = 10
|
||||||
|
|
||||||
# Name used for python install trace
|
# Config files messed with...
|
||||||
HORIZON_NAME = ROOT_HORIZON
|
HORIZON_LOCAL_SETTINGS_CONF = "local_settings.py"
|
||||||
DASH_NAME = 'dashboard'
|
HORIZON_APACHE_CONF = 'horizon_apache.conf'
|
||||||
|
CONFIGS = [HORIZON_LOCAL_SETTINGS_CONF, HORIZON_APACHE_CONF]
|
||||||
# Config files messed with
|
|
||||||
HORIZON_PY_CONF = "horizon_settings.py"
|
|
||||||
HORIZON_APACHE_CONF = 'horizon.conf'
|
|
||||||
CONFIGS = [HORIZON_PY_CONF, HORIZON_APACHE_CONF]
|
|
||||||
|
|
||||||
# DB sync that needs to happen for horizon
|
|
||||||
DB_SYNC_CMD = ['python', 'manage.py', 'syncdb', '--noinput']
|
|
||||||
|
|
||||||
# Users which apache may not like starting as..
|
# Users which apache may not like starting as..
|
||||||
BAD_APACHE_USERS = ['root']
|
BAD_APACHE_USERS = ['root']
|
||||||
|
|
||||||
# This db will be dropped and created
|
|
||||||
DB_NAME = 'horizon'
|
|
||||||
|
|
||||||
|
|
||||||
class HorizonUninstaller(comp.PythonUninstallComponent):
|
class HorizonUninstaller(comp.PythonUninstallComponent):
|
||||||
def __init__(self, *args, **kargs):
|
def __init__(self, *args, **kargs):
|
||||||
@ -88,6 +78,10 @@ class HorizonInstaller(comp.PythonInstallComponent):
|
|||||||
def _install_node_repo(self):
|
def _install_node_repo(self):
|
||||||
repo_url = self.get_option('nodejs_repo')
|
repo_url = self.get_option('nodejs_repo')
|
||||||
if not repo_url:
|
if not repo_url:
|
||||||
|
# Ok then, hope node js is in your path for when horizon attempts
|
||||||
|
# to use it... if not possibly follow:
|
||||||
|
#
|
||||||
|
# http://www.chrisabernethy.com/installing-node-js-on-centos-redhat/
|
||||||
return
|
return
|
||||||
# Download the said url and install it so that we can actually install
|
# Download the said url and install it so that we can actually install
|
||||||
# the node.js requirement which seems to be needed by horizon for css compiling??
|
# the node.js requirement which seems to be needed by horizon for css compiling??
|
||||||
@ -112,7 +106,7 @@ class HorizonInstaller(comp.PythonInstallComponent):
|
|||||||
elif fn_ext == ".rpm":
|
elif fn_ext == ".rpm":
|
||||||
# Install it instead from said rpm (which likely is a
|
# Install it instead from said rpm (which likely is a
|
||||||
# file that contains said repo location)...
|
# file that contains said repo location)...
|
||||||
packager = yum.YumPackager(self.distro).direct_install(temp_fh.name)
|
yum.YumPackager(self.distro).direct_install(temp_fh.name)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def symlinks(self):
|
def symlinks(self):
|
||||||
@ -136,9 +130,8 @@ class HorizonInstaller(comp.PythonInstallComponent):
|
|||||||
raise excp.ConfigException(msg)
|
raise excp.ConfigException(msg)
|
||||||
|
|
||||||
def target_config(self, config_name):
|
def target_config(self, config_name):
|
||||||
if config_name == HORIZON_PY_CONF:
|
if config_name == HORIZON_LOCAL_SETTINGS_CONF:
|
||||||
# FIXME(harlowja) don't write to checked out locations...
|
return sh.joinpths(self.get_option('app_dir'), 'openstack_dashboard', 'local', config_name)
|
||||||
return sh.joinpths(self.get_option('app_dir'), ROOT_DASH, 'local', 'local_settings.py')
|
|
||||||
else:
|
else:
|
||||||
return comp.PythonInstallComponent.target_config(self, config_name)
|
return comp.PythonInstallComponent.target_config(self, config_name)
|
||||||
|
|
||||||
@ -162,24 +155,6 @@ class HorizonInstaller(comp.PythonInstallComponent):
|
|||||||
sh.chmod(fn, 0666)
|
sh.chmod(fn, 0666)
|
||||||
return len(log_fns)
|
return len(log_fns)
|
||||||
|
|
||||||
def _sync_db(self):
|
|
||||||
# Initialize the horizon database (it stores sessions and notices shown to users).
|
|
||||||
# The user system is external (keystone).
|
|
||||||
LOG.info("Syncing horizon to database: %s", colorizer.quote(DB_NAME))
|
|
||||||
sh.execute(*DB_SYNC_CMD, cwd=self.get_option('app_dir'))
|
|
||||||
|
|
||||||
def _setup_db(self):
|
|
||||||
dbhelper.drop_db(distro=self.distro,
|
|
||||||
dbtype=self.get_option('db', 'type'),
|
|
||||||
dbname=DB_NAME,
|
|
||||||
**utils.merge_dicts(self.get_option('db'),
|
|
||||||
dbhelper.get_shared_passwords(self)))
|
|
||||||
dbhelper.create_db(distro=self.distro,
|
|
||||||
dbtype=self.get_option('db', 'type'),
|
|
||||||
dbname=DB_NAME,
|
|
||||||
**utils.merge_dicts(self.get_option('db'),
|
|
||||||
dbhelper.get_shared_passwords(self)))
|
|
||||||
|
|
||||||
def _configure_files(self):
|
def _configure_files(self):
|
||||||
am = comp.PythonInstallComponent._configure_files(self)
|
am = comp.PythonInstallComponent._configure_files(self)
|
||||||
am += self._setup_logs(self.get_bool_option('clear-logs'))
|
am += self._setup_logs(self.get_bool_option('clear-logs'))
|
||||||
@ -187,9 +162,6 @@ class HorizonInstaller(comp.PythonInstallComponent):
|
|||||||
|
|
||||||
def post_install(self):
|
def post_install(self):
|
||||||
comp.PythonInstallComponent.post_install(self)
|
comp.PythonInstallComponent.post_install(self)
|
||||||
if self.get_bool_option('db-sync'):
|
|
||||||
self._setup_db()
|
|
||||||
self._sync_db()
|
|
||||||
if self.get_bool_option('make-blackhole'):
|
if self.get_bool_option('make-blackhole'):
|
||||||
self._setup_blackhole()
|
self._setup_blackhole()
|
||||||
|
|
||||||
@ -212,11 +184,10 @@ class HorizonInstaller(comp.PythonInstallComponent):
|
|||||||
mp['BLACK_HOLE_DIR'] = self.blackhole_dir
|
mp['BLACK_HOLE_DIR'] = self.blackhole_dir
|
||||||
else:
|
else:
|
||||||
mp['OPENSTACK_HOST'] = self.get_option('ip')
|
mp['OPENSTACK_HOST'] = self.get_option('ip')
|
||||||
mp['DB_NAME'] = DB_NAME
|
if SECRET_KEY_LEN <= 0:
|
||||||
mp['DB_USER'] = self.get_option('db', 'user')
|
mp['SECRET_KEY'] = ''
|
||||||
mp['DB_PASSWORD'] = dbhelper.get_shared_passwords(self)['pw']
|
else:
|
||||||
mp['DB_HOST'] = self.get_option("db", "host")
|
mp['SECRET_KEY'] = binascii.b2a_hex(os.urandom(SECRET_KEY_LEN / 2))
|
||||||
mp['DB_PORT'] = self.get_option("db", "port")
|
|
||||||
return mp
|
return mp
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ options:
|
|||||||
do-init: true
|
do-init: true
|
||||||
enable-pki: false
|
enable-pki: false
|
||||||
horizon:
|
horizon:
|
||||||
db-sync: true
|
|
||||||
make-blackhole: true
|
make-blackhole: true
|
||||||
subsystems:
|
subsystems:
|
||||||
glance:
|
glance:
|
||||||
|
@ -7,11 +7,11 @@ components:
|
|||||||
- nova-client
|
- nova-client
|
||||||
- quantum-client
|
- quantum-client
|
||||||
- swift-client
|
- swift-client
|
||||||
|
- cinder-client
|
||||||
- horizon
|
- horizon
|
||||||
options:
|
options:
|
||||||
horizon:
|
horizon:
|
||||||
db-sync: true
|
db-sync: true
|
||||||
make-blackhole: true
|
|
||||||
supports:
|
supports:
|
||||||
- rhel
|
- rhel
|
||||||
...
|
...
|
||||||
|
@ -1,107 +0,0 @@
|
|||||||
#*
|
|
||||||
This is a cheetah template!
|
|
||||||
*#
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
DEBUG = True
|
|
||||||
TEMPLATE_DEBUG = DEBUG
|
|
||||||
PROD = False
|
|
||||||
USE_SSL = False
|
|
||||||
|
|
||||||
LOCAL_PATH = os.path.dirname(os.path.abspath(__file__))
|
|
||||||
|
|
||||||
DATABASES = {
|
|
||||||
'default': {
|
|
||||||
'ENGINE': 'django.db.backends.mysql',
|
|
||||||
'NAME': '${DB_NAME}',
|
|
||||||
'USER': '${DB_USER}',
|
|
||||||
'PASSWORD': '${DB_PASSWORD}',
|
|
||||||
'HOST': '${DB_HOST}',
|
|
||||||
'PORT': '${DB_PORT}',
|
|
||||||
'TEST_NAME': '${DB_NAME}_test',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
# The default values for these two settings seem to cause issues with apache
|
|
||||||
CACHE_BACKEND = 'dummy://'
|
|
||||||
SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
|
|
||||||
|
|
||||||
# Send email to the console by default
|
|
||||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
|
||||||
|
|
||||||
# django-mailer uses a different settings attribute
|
|
||||||
MAILER_EMAIL_BACKEND = EMAIL_BACKEND
|
|
||||||
|
|
||||||
# Set a secure and unique SECRET_KEY (the Django default is '')
|
|
||||||
from horizon.utils import secret_key
|
|
||||||
SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH, '.secret_key_store'))
|
|
||||||
|
|
||||||
HORIZON_CONFIG = {
|
|
||||||
'dashboards': ('nova', 'syspanel', 'settings',),
|
|
||||||
'default_dashboard': 'nova',
|
|
||||||
}
|
|
||||||
|
|
||||||
# TODO(tres): Remove these once Keystone has an API to identify auth backend.
|
|
||||||
OPENSTACK_KEYSTONE_BACKEND = {
|
|
||||||
'name': 'native',
|
|
||||||
'can_edit_user': True
|
|
||||||
}
|
|
||||||
|
|
||||||
OPENSTACK_HOST = "${OPENSTACK_HOST}"
|
|
||||||
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v2.0" % OPENSTACK_HOST
|
|
||||||
|
|
||||||
# FIXME: this is only needed until keystone fixes its GET /tenants call
|
|
||||||
# so that it doesn't return everything for admins
|
|
||||||
OPENSTACK_KEYSTONE_ADMIN_URL = "http://%s:35357/v2.0" % OPENSTACK_HOST
|
|
||||||
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "Member"
|
|
||||||
|
|
||||||
# If you have external monitoring links, eg:
|
|
||||||
# EXTERNAL_MONITORING = [
|
|
||||||
# ['Nagios','http://foo.com'],
|
|
||||||
# ['Ganglia','http://bar.com'],
|
|
||||||
# ]
|
|
||||||
|
|
||||||
#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,
|
|
||||||
# },
|
|
||||||
# 'horizon': {
|
|
||||||
# 'handlers': ['console'],
|
|
||||||
# 'propagate': False,
|
|
||||||
# },
|
|
||||||
# 'novaclient': {
|
|
||||||
# 'handlers': ['console'],
|
|
||||||
# 'propagate': False,
|
|
||||||
# },
|
|
||||||
# 'keystoneclient': {
|
|
||||||
# 'handlers': ['console'],
|
|
||||||
# 'propagate': False,
|
|
||||||
# },
|
|
||||||
# 'nose.plugins.manager': {
|
|
||||||
# 'handlers': ['console'],
|
|
||||||
# 'propagate': False,
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
#}
|
|
115
conf/templates/horizon/local_settings.py
Normal file
115
conf/templates/horizon/local_settings.py
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
#*
|
||||||
|
This is a cheetah template!
|
||||||
|
*#
|
||||||
|
|
||||||
|
# These settings are good for dev-like environments (or ci)
|
||||||
|
# When moving to production it is likely some more thought should
|
||||||
|
# be given here...
|
||||||
|
#
|
||||||
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/
|
||||||
|
#
|
||||||
|
# This file overrides other defaults in openstack_dashboard/settings.py
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
DEBUG = True
|
||||||
|
TEMPLATE_DEBUG = DEBUG
|
||||||
|
PROD = False
|
||||||
|
USE_SSL = False
|
||||||
|
|
||||||
|
LOCAL_PATH = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
# See: https://docs.djangoproject.com/en/dev/topics/cache/?from=olddocs
|
||||||
|
CACHES = {
|
||||||
|
'default': {
|
||||||
|
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Use session cookies for any user-specific horizon session data
|
||||||
|
SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'
|
||||||
|
|
||||||
|
# Send email to the console by default
|
||||||
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||||
|
|
||||||
|
# See: https://code.google.com/p/django-mailer/
|
||||||
|
#
|
||||||
|
# django-mailer uses a different settings attribute
|
||||||
|
MAILER_EMAIL_BACKEND = EMAIL_BACKEND
|
||||||
|
|
||||||
|
# Set a secure and unique SECRET_KEY (the Django default is '')
|
||||||
|
#
|
||||||
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-SECRET_KEY
|
||||||
|
SECRET_KEY = "${SECRET_KEY}"
|
||||||
|
|
||||||
|
# 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
|
||||||
|
}
|
||||||
|
|
||||||
|
OPENSTACK_HOST = "${OPENSTACK_HOST}"
|
||||||
|
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v2.0" % OPENSTACK_HOST
|
||||||
|
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "Member"
|
||||||
|
|
||||||
|
# The timezone of the server. This should correspond with the timezone
|
||||||
|
# of your entire OpenStack installation, and hopefully be in UTC.
|
||||||
|
TIME_ZONE = "UTC"
|
||||||
|
|
||||||
|
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,
|
||||||
|
},
|
||||||
|
'horizon': {
|
||||||
|
'handlers': ['console'],
|
||||||
|
'propagate': False,
|
||||||
|
},
|
||||||
|
'openstack_dashboard': {
|
||||||
|
'handlers': ['console'],
|
||||||
|
'propagate': False,
|
||||||
|
},
|
||||||
|
'novaclient': {
|
||||||
|
'handlers': ['console'],
|
||||||
|
'propagate': False,
|
||||||
|
},
|
||||||
|
'keystoneclient': {
|
||||||
|
'handlers': ['console'],
|
||||||
|
'propagate': False,
|
||||||
|
},
|
||||||
|
'glanceclient': {
|
||||||
|
'handlers': ['console'],
|
||||||
|
'propagate': False,
|
||||||
|
},
|
||||||
|
'nose.plugins.manager': {
|
||||||
|
'handlers': ['console'],
|
||||||
|
'propagate': False,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user