Added Nuage Networks extensions

Partial-Bug: #1521065
Change-Id: I85c462c0d2a8449c8bc167afaded2ef13d5319b2
This commit is contained in:
Remi Vichery 2015-11-17 11:06:14 -08:00 committed by XiaoPei Liu
parent 2576525691
commit a30f9696f5
8 changed files with 59 additions and 2 deletions

View File

@ -96,6 +96,14 @@ default['openstack']['dashboard']['db_python_packages'] = {
# library.
default['openstack']['dashboard']['hash_algorithm'] = 'md5'
# ----------------------------- Nuage Networks Horizon Customization -------
# Enable Nuage Networks Horizon Extensions
default['openstack']['dashboard']['nuage']['customization_module']['enabled'] = false
default['openstack']['dashboard']['nuage']['customization_module']['name'] = 'nuage_horizon.customization'
# --------------------------------------------------------------------------
case node['platform_family']
when 'rhel'
default['openstack']['dashboard']['horizon_user'] = 'apache'
@ -111,9 +119,12 @@ when 'rhel'
default['openstack']['dashboard']['platform'] = {
'horizon_packages' => ['openstack-dashboard'],
'memcache_python_packages' => ['python-memcached'],
'nuage_horizon_packages' => ['nuage-openstack-horizon'],
'package_overrides' => ''
}
default['openstack']['dashboard']['apache']['sites-path'] = "#{node['apache']['dir']}/sites-available/openstack-dashboard.conf"
default['openstack']['dashboard']['nuage']['customization_module']['static_path'] = '/usr/lib/python2.7/site-packages/nuage_horizon/static/'
default['openstack']['dashboard']['nuage']['customization_module']['path'] = '/usr/lib/python2.7/site-packages/nuage_horizon'
when 'suse'
default['openstack']['dashboard']['horizon_user'] = 'wwwrun'
default['openstack']['dashboard']['horizon_group'] = 'www'
@ -127,9 +138,12 @@ when 'suse'
default['openstack']['dashboard']['platform'] = {
'horizon_packages' => ['openstack-dashboard'],
'memcache_python_packages' => ['python-python-memcached'],
'nuage_horizon_packages' => ['nuage-openstack-horizon'],
'package_overrides' => ''
}
default['openstack']['dashboard']['apache']['sites-path'] = "#{node['apache']['dir']}/conf.d/openstack-dashboard.conf"
default['openstack']['dashboard']['nuage']['customization_module']['static_path'] = '/usr/lib/python2.7/site-packages/nuage_horizon/static/'
default['openstack']['dashboard']['nuage']['customization_module']['path'] = '/usr/lib/python2.7/site-packages/nuage_horizon'
when 'debian'
default['openstack']['dashboard']['horizon_user'] = 'horizon'
default['openstack']['dashboard']['horizon_group'] = 'horizon'
@ -142,10 +156,13 @@ when 'debian'
default['openstack']['dashboard']['login_redirect_url'] = nil
default['openstack']['dashboard']['platform'] = {
'memcache_python_packages' => ['python-memcache'],
'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'"
'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'",
'nuage_horizon_packages' => ['nuage-openstack-horizon']
}
default['openstack']['dashboard']['platform']['horizon_packages'] = ['node-less', 'openstack-dashboard']
default['openstack']['dashboard']['apache']['sites-path'] = "#{node['apache']['dir']}/sites-available/openstack-dashboard.conf"
default['openstack']['dashboard']['nuage']['customization_module']['static_path'] = '/usr/lib/python2.7/dist-packages/nuage_horizon/static/'
default['openstack']['dashboard']['nuage']['customization_module']['path'] = '/usr/lib/python2.7/dist-packages/nuage_horizon'
end
default['openstack']['dashboard']['dash_path'] = "#{node['openstack']['dashboard']['django_path']}/openstack_dashboard"

View File

@ -4,7 +4,7 @@ maintainer_email 'opscode-chef-openstack@googlegroups.com'
license 'Apache 2.0'
description 'Installs/Configures the OpenStack Dashboard (Horizon)'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '11.0.0'
version '11.1.0'
recipe 'openstack-dashboard::horizon', 'Sets up the Horizon dashboard.'
recipe 'openstack-dashboard::apache2-server', 'Sets up an Apache `mod_wsgi` container to run the dashboard.'

View File

@ -48,6 +48,12 @@ python_packages += Array(node['openstack']['dashboard']['db_python_packages'][db
end
end
if node['openstack']['dashboard']['nuage']['customization_module']['enabled']
platform_options['nuage_horizon_packages'].each do |pkg|
package pkg
end
end
if node['openstack']['dashboard']['session_backend'] == 'memcached'
platform_options['memcache_python_packages'].each do |pkg|
package pkg

View File

@ -24,6 +24,11 @@ describe 'openstack-dashboard::horizon' do
end
end
it 'installs nuage packages if dashboard nuage customization module is enabled' do
node.set['openstack']['dashboard']['nuage']['customization_module']['enabled'] = true
expect(chef_run).to install_package('nuage-openstack-horizon')
end
describe 'local_settings' do
let(:file) { chef_run.template('/etc/openstack-dashboard/local_settings') }

View File

@ -20,6 +20,11 @@ describe 'openstack-dashboard::horizon' do
end
end
it 'installs nuage packages if dashboard nuage customization module is enabled' do
node.set['openstack']['dashboard']['nuage']['customization_module']['enabled'] = true
expect(chef_run).to install_package('nuage-openstack-horizon')
end
describe 'local_settings.py' do
let(:file) { chef_run.template('/srv/www/openstack-dashboard/openstack_dashboard/local/local_settings.py') }

View File

@ -23,6 +23,11 @@ describe 'openstack-dashboard::horizon' do
expect(chef_run).to upgrade_package('python-mysqldb')
end
it 'installs nuage packages if dashboard nuage customazation module is enabled' do
node.set['openstack']['dashboard']['nuage']['customization_module']['enabled'] = true
expect(chef_run).to install_package('nuage-openstack-horizon')
end
describe 'local_settings.py' do
let(:file) { chef_run.template('/etc/openstack-dashboard/local_settings.py') }

View File

@ -34,6 +34,9 @@ NameVirtualHost <%= @https_bind_address %>:<%= @https_bind_port %>
WSGIProcessGroup dashboard
DocumentRoot <%= node["openstack"]["dashboard"]["dash_path"] %>/.blackhole/
<% if node["openstack"]["dashboard"]["nuage"]["customization_module"]["enabled"] %>
Alias /static/nuage <%= node["openstack"]["dashboard"]["nuage"]["customization_module"]["static_path"] %>
<% end %>
Alias /static <%= node["openstack"]["dashboard"]["static_path"] %>
<Directory />
@ -63,6 +66,19 @@ NameVirtualHost <%= @https_bind_address %>:<%= @https_bind_port %>
<% end -%>
</Directory>
<% if node["openstack"]["dashboard"]["nuage"]["customization_module"]["enabled"] %>
<Directory <%= node["openstack"]["dashboard"]["nuage"]["customization_module"]["path"] %>>
Options FollowSymLinks
AllowOverride None
<% if node['apache']['version'] == '2.4' -%>
Require all granted
<% else -%>
Order allow,deny
allow from all
<% end -%>
</Directory>
<% end %>
<% if node["openstack"]["dashboard"]["use_ssl"] -%>
SSLEngine on
SSLCertificateFile <%= @ssl_cert_file %>

View File

@ -77,6 +77,9 @@ HORIZON_CONFIG = {
'fade_duration': 1500,
'types': ['alert-success', 'alert-info']
},
<% if node["openstack"]["dashboard"]["nuage"]["customization_module"]["enabled"] %>
'customization_module': "<%= node["openstack"]["dashboard"]["nuage"]["customization_module"]["name"] %>",
<% end %>
'help_url': "<%= node["openstack"]["dashboard"]["help_url"] %>",
'exceptions': {'recoverable': exceptions.RECOVERABLE,
'not_found': exceptions.NOT_FOUND,