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,
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 (
get_ca_cert,
get_cert,
@ -172,6 +176,7 @@ class IdentityServiceContext(OSContextGenerator):
class HorizonContext(OSContextGenerator):
def __call__(self):
''' Provide all configuration for Horizon '''
projects_yaml = git_default_repos(config('openstack-origin-git'))
ctxt = {
'compress_offline': config('offline-compression') 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_vpn": config("neutron-network-vpn"),
"cinder_backup": config("cinder-backup"),
'virtualenv': git_pip_venv_dir(projects_yaml)
if config('openstack-origin-git') else None,
}
return ctxt

View File

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

View File

@ -58,9 +58,6 @@ from charmhelpers.core.host import (
path_hash,
service,
)
from charmhelpers.core.templating import (
render,
)
from charmhelpers.fetch import (
apt_upgrade,
apt_update,
@ -411,11 +408,6 @@ def git_post_install(projects_yaml):
os.remove(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('/usr/share/openstack-dashboard/manage.py', 0o755),
@ -446,8 +438,6 @@ def git_post_install(projects_yaml):
for f in files:
os.lchown(os.path.join(root, f), uid, gid)
subprocess.check_call(['a2enconf', 'openstack-dashboard'])
if not is_unit_paused_set():
service_restart('apache2')
@ -456,10 +446,10 @@ def git_post_install_late(projects_yaml):
"""Perform horizon post-install setup."""
projects_yaml = git_default_repos(projects_yaml)
render('git/dashboard.conf',
'/etc/apache2/conf-available/openstack-dashboard.conf',
{'virtualenv': git_pip_venv_dir(projects_yaml)},
owner='root', group='root', perms=0o644)
subprocess.check_call(['a2enconf', 'openstack-dashboard'])
if not is_unit_paused_set():
service_restart('apache2')
python = os.path.join(git_pip_venv_dir(projects_yaml), 'bin/python')
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
WSGIDaemonProcess horizon user=horizon group=horizon processes=3 threads=10
WSGIProcessGroup horizon
{% if virtualenv %}
WSGIPythonHome {{ virtualenv }}
{% endif %}
Alias /static /usr/share/openstack-dashboard/openstack_dashboard/static/
<Directory /usr/share/openstack-dashboard/openstack_dashboard/wsgi>
Order allow,deny

View File

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

View File

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