Use openstack-dashboard.conf template for deploy from source

Drop the DFS-specific rendering of dashboard.conf and just use
the openstack-dashboard.conf that the non-DFS code uses.

Change-Id: Ief4f712688af7f8a347d7df59c6b14a5d285d5ad
This commit is contained in:
Corey Bryant 2016-09-14 20:41:12 +00:00
parent 2214352ba1
commit 2f57b25116
7 changed files with 27 additions and 24 deletions

View File

@ -30,7 +30,11 @@ from charmhelpers.contrib.openstack.context import (
HAProxyContext, HAProxyContext,
context_complete context_complete
) )
from charmhelpers.contrib.openstack.utils import get_host_ip from charmhelpers.contrib.openstack.utils import (
get_host_ip,
git_default_repos,
git_pip_venv_dir,
)
from charmhelpers.contrib.hahelpers.apache import ( from charmhelpers.contrib.hahelpers.apache import (
get_ca_cert, get_ca_cert,
get_cert, get_cert,
@ -172,6 +176,7 @@ class IdentityServiceContext(OSContextGenerator):
class HorizonContext(OSContextGenerator): class HorizonContext(OSContextGenerator):
def __call__(self): def __call__(self):
''' Provide all configuration for Horizon ''' ''' Provide all configuration for Horizon '''
projects_yaml = git_default_repos(config('openstack-origin-git'))
ctxt = { ctxt = {
'compress_offline': config('offline-compression') in ['yes', True], 'compress_offline': config('offline-compression') in ['yes', True],
'debug': config('debug') in ['yes', True], 'debug': config('debug') in ['yes', True],
@ -185,6 +190,8 @@ class HorizonContext(OSContextGenerator):
"neutron_network_firewall": config("neutron-network-firewall"), "neutron_network_firewall": config("neutron-network-firewall"),
"neutron_network_vpn": config("neutron-network-vpn"), "neutron_network_vpn": config("neutron-network-vpn"),
"cinder_backup": config("cinder-backup"), "cinder_backup": config("cinder-backup"),
'virtualenv': git_pip_venv_dir(projects_yaml)
if config('openstack-origin-git') else None,
} }
return ctxt return ctxt

View File

@ -102,6 +102,7 @@ def install():
status_set('maintenance', 'Installing packages') status_set('maintenance', 'Installing packages')
apt_install(packages, fatal=True) apt_install(packages, fatal=True)
status_set('maintenance', 'Git install')
git_install(config('openstack-origin-git')) git_install(config('openstack-origin-git'))
@ -137,6 +138,7 @@ def config_changed():
if git_install_requested(): if git_install_requested():
if config_value_changed('openstack-origin-git'): if config_value_changed('openstack-origin-git'):
status_set('maintenance', 'Running Git install')
git_install(config('openstack-origin-git')) git_install(config('openstack-origin-git'))
elif not config('action-managed-upgrade'): elif not config('action-managed-upgrade'):
if openstack_upgrade_available('openstack-dashboard'): if openstack_upgrade_available('openstack-dashboard'):

View File

@ -58,9 +58,6 @@ from charmhelpers.core.host import (
path_hash, path_hash,
service, service,
) )
from charmhelpers.core.templating import (
render,
)
from charmhelpers.fetch import ( from charmhelpers.fetch import (
apt_upgrade, apt_upgrade,
apt_update, apt_update,
@ -411,11 +408,6 @@ def git_post_install(projects_yaml):
os.remove(s['link']) os.remove(s['link'])
os.symlink(s['src'], s['link']) os.symlink(s['src'], s['link'])
render('git/dashboard.conf',
'/etc/apache2/conf-available/openstack-dashboard.conf',
{'virtualenv': git_pip_venv_dir(projects_yaml)},
owner='root', group='root', perms=0o644)
os.chmod('/var/lib/openstack-dashboard', 0o750) os.chmod('/var/lib/openstack-dashboard', 0o750)
os.chmod('/usr/share/openstack-dashboard/manage.py', 0o755), os.chmod('/usr/share/openstack-dashboard/manage.py', 0o755),
@ -446,8 +438,6 @@ def git_post_install(projects_yaml):
for f in files: for f in files:
os.lchown(os.path.join(root, f), uid, gid) os.lchown(os.path.join(root, f), uid, gid)
subprocess.check_call(['a2enconf', 'openstack-dashboard'])
if not is_unit_paused_set(): if not is_unit_paused_set():
service_restart('apache2') service_restart('apache2')
@ -456,10 +446,10 @@ def git_post_install_late(projects_yaml):
"""Perform horizon post-install setup.""" """Perform horizon post-install setup."""
projects_yaml = git_default_repos(projects_yaml) projects_yaml = git_default_repos(projects_yaml)
render('git/dashboard.conf', subprocess.check_call(['a2enconf', 'openstack-dashboard'])
'/etc/apache2/conf-available/openstack-dashboard.conf',
{'virtualenv': git_pip_venv_dir(projects_yaml)}, if not is_unit_paused_set():
owner='root', group='root', perms=0o644) service_restart('apache2')
python = os.path.join(git_pip_venv_dir(projects_yaml), 'bin/python') python = os.path.join(git_pip_venv_dir(projects_yaml), 'bin/python')
subprocess.check_call([python, '/usr/share/openstack-dashboard/manage.py', subprocess.check_call([python, '/usr/share/openstack-dashboard/manage.py',

View File

@ -1,9 +0,0 @@
WSGIScriptAlias /horizon /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi
WSGIDaemonProcess horizon user=horizon group=horizon processes=3 threads=10
WSGIProcessGroup horizon
WSGIPythonHome {{ virtualenv }}
Alias /static /usr/share/openstack-dashboard/openstack_dashboard/static/
<Directory /usr/share/openstack-dashboard/openstack_dashboard/wsgi>
Order allow,deny
Allow from all
</Directory>

View File

@ -1,6 +1,9 @@
WSGIScriptAlias {{ webroot }} /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi WSGIScriptAlias {{ webroot }} /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi
WSGIDaemonProcess horizon user=horizon group=horizon processes=3 threads=10 WSGIDaemonProcess horizon user=horizon group=horizon processes=3 threads=10
WSGIProcessGroup horizon WSGIProcessGroup horizon
{% if virtualenv %}
WSGIPythonHome {{ virtualenv }}
{% endif %}
Alias /static /usr/share/openstack-dashboard/openstack_dashboard/static/ Alias /static /usr/share/openstack-dashboard/openstack_dashboard/static/
<Directory /usr/share/openstack-dashboard/openstack_dashboard/wsgi> <Directory /usr/share/openstack-dashboard/openstack_dashboard/wsgi>
Order allow,deny Order allow,deny

View File

@ -1,6 +1,9 @@
WSGIScriptAlias {{ webroot }} /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi WSGIScriptAlias {{ webroot }} /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi
WSGIDaemonProcess horizon user=horizon group=horizon processes=3 threads=10 WSGIDaemonProcess horizon user=horizon group=horizon processes=3 threads=10
WSGIProcessGroup horizon WSGIProcessGroup horizon
{% if virtualenv %}
WSGIPythonHome {{ virtualenv }}
{% endif %}
Alias /static /usr/share/openstack-dashboard/openstack_dashboard/static/ Alias /static /usr/share/openstack-dashboard/openstack_dashboard/static/
Alias /horizon/static /usr/share/openstack-dashboard/openstack_dashboard/static/ Alias /horizon/static /usr/share/openstack-dashboard/openstack_dashboard/static/
<Directory /usr/share/openstack-dashboard/openstack_dashboard/wsgi> <Directory /usr/share/openstack-dashboard/openstack_dashboard/wsgi>

View File

@ -104,6 +104,7 @@ class TestHorizonContexts(CharmTestCase):
{'compress_offline': True, 'debug': False, {'compress_offline': True, 'debug': False,
'default_role': 'Member', 'webroot': '/horizon', 'default_role': 'Member', 'webroot': '/horizon',
'ubuntu_theme': True, 'ubuntu_theme': True,
'virtualenv': None,
'secret': 'secret', 'secret': 'secret',
'support_profile': None, 'support_profile': None,
"neutron_network_lb": False, "neutron_network_lb": False,
@ -117,6 +118,7 @@ class TestHorizonContexts(CharmTestCase):
{'compress_offline': True, 'debug': True, {'compress_offline': True, 'debug': True,
'default_role': 'Member', 'webroot': '/horizon', 'default_role': 'Member', 'webroot': '/horizon',
'ubuntu_theme': True, 'ubuntu_theme': True,
'virtualenv': None,
'secret': 'secret', 'secret': 'secret',
'support_profile': None, 'support_profile': None,
"neutron_network_lb": False, "neutron_network_lb": False,
@ -130,6 +132,7 @@ class TestHorizonContexts(CharmTestCase):
{'compress_offline': True, 'debug': False, {'compress_offline': True, 'debug': False,
'default_role': 'Member', 'webroot': '/horizon', 'default_role': 'Member', 'webroot': '/horizon',
'ubuntu_theme': False, 'ubuntu_theme': False,
'virtualenv': None,
'secret': 'secret', 'secret': 'secret',
'support_profile': None, 'support_profile': None,
"neutron_network_lb": False, "neutron_network_lb": False,
@ -143,6 +146,7 @@ class TestHorizonContexts(CharmTestCase):
{'compress_offline': False, 'debug': False, {'compress_offline': False, 'debug': False,
'default_role': 'Member', 'webroot': '/horizon', 'default_role': 'Member', 'webroot': '/horizon',
'ubuntu_theme': True, 'ubuntu_theme': True,
'virtualenv': None,
'secret': 'secret', 'secret': 'secret',
'support_profile': None, 'support_profile': None,
"neutron_network_lb": False, "neutron_network_lb": False,
@ -156,6 +160,7 @@ class TestHorizonContexts(CharmTestCase):
{'compress_offline': True, 'debug': False, {'compress_offline': True, 'debug': False,
'default_role': 'foo', 'webroot': '/horizon', 'default_role': 'foo', 'webroot': '/horizon',
'ubuntu_theme': True, 'ubuntu_theme': True,
'virtualenv': None,
'secret': 'secret', 'secret': 'secret',
'support_profile': None, 'support_profile': None,
"neutron_network_lb": False, "neutron_network_lb": False,
@ -169,6 +174,7 @@ class TestHorizonContexts(CharmTestCase):
{'compress_offline': True, 'debug': False, {'compress_offline': True, 'debug': False,
'default_role': 'Member', 'webroot': '/', 'default_role': 'Member', 'webroot': '/',
'ubuntu_theme': True, 'ubuntu_theme': True,
'virtualenv': None,
'secret': 'secret', 'secret': 'secret',
'support_profile': None, 'support_profile': None,
"neutron_network_lb": False, "neutron_network_lb": False,
@ -185,6 +191,7 @@ class TestHorizonContexts(CharmTestCase):
{'compress_offline': True, 'debug': False, {'compress_offline': True, 'debug': False,
'default_role': 'Member', 'webroot': '/horizon', 'default_role': 'Member', 'webroot': '/horizon',
'ubuntu_theme': True, 'ubuntu_theme': True,
'virtualenv': None,
'secret': 'secret', 'secret': 'secret',
'support_profile': None, 'support_profile': None,
"neutron_network_lb": True, "neutron_network_lb": True,