Multiple dashboard fixes and refactoring
* added recipe neutron-lbaas-dashboard to install the dashboard plugin according to the current docs * removed server.rb recipe and server_type attribute since the only available option is apache2 * adapted specs and README accordingly Change-Id: I4f407598acccd2d21d4204b936122963ebd4f7c8
This commit is contained in:
parent
7742a929dc
commit
3548100c1b
11
README.md
11
README.md
|
@ -52,16 +52,15 @@ Recipes
|
|||
|
||||
## openstack-dashboard::horizon
|
||||
- Sets up the packages needed to run the Horizon dashboard and its dependencies.
|
||||
Will be included from the `server` recipe.
|
||||
Includes openstack-dashboard::apache2-server recipe.
|
||||
|
||||
## openstack-dashboard::apache2-server
|
||||
- Installs the Apache webserver and sets up an `mod_wsgi` container to run the
|
||||
Horizon dashboard. Will be included from the `server` recipe.
|
||||
Horizon dashboard.
|
||||
|
||||
## openstack-dashboard::server
|
||||
- Sets up the Horizon dashboard and a webserver of type
|
||||
`['openstack']['dashboard']['server_type']` to run it, default type is
|
||||
'apache2'.
|
||||
## openstack-dashboard::neutron-lbaas-dashboard
|
||||
- Installs the python neutron-lbaas-dashboard package. Includes
|
||||
openstack-dashboard::horizon recipe at the beginning.
|
||||
|
||||
|
||||
License and Author
|
||||
|
|
|
@ -37,7 +37,6 @@ default['openstack']['bind_service']['dashboard_https']['port'] = '443'
|
|||
|
||||
# ********************************************************************************
|
||||
|
||||
default['openstack']['dashboard']['server_type'] = 'apache2'
|
||||
default['openstack']['dashboard']['debug'] = false
|
||||
|
||||
# Don't cache html pages.
|
||||
|
@ -236,3 +235,5 @@ default['openstack']['dashboard']['neutron']['enable_lb'] = false
|
|||
# 'varable2': 'value2',
|
||||
# }
|
||||
default['openstack']['dashboard']['misc_local_settings'] = nil
|
||||
# version of python neutron-lbaas-dashboard package to install
|
||||
default['openstack']['dashboard']['lbaas']['version'] = '1.0.0'
|
||||
|
|
|
@ -15,3 +15,4 @@ end
|
|||
depends 'apache2', '~> 3.2'
|
||||
depends 'openstack-common', '>= 14.0.0'
|
||||
depends 'openstack-identity', '>= 14.0.0'
|
||||
depends 'poise-python', '~> 1.5.1'
|
||||
|
|
|
@ -41,9 +41,9 @@ https_bind = node['openstack']['bind_service']['dashboard_https']
|
|||
https_bind_address = bind_address https_bind
|
||||
|
||||
horizon_host = if node['openstack']['dashboard']['use_ssl']
|
||||
http_bind_address
|
||||
else
|
||||
https_bind_address
|
||||
else
|
||||
http_bind_address
|
||||
end
|
||||
|
||||
db_pass = get_password 'db', 'horizon'
|
||||
|
@ -65,6 +65,7 @@ if node['openstack']['dashboard']['session_backend'] == 'memcached'
|
|||
end
|
||||
end
|
||||
|
||||
django_path = node['openstack']['dashboard']['django_path']
|
||||
memcached = memcached_servers
|
||||
|
||||
template node['openstack']['dashboard']['local_settings_path'] do
|
||||
|
@ -83,12 +84,12 @@ template node['openstack']['dashboard']['local_settings_path'] do
|
|||
host: horizon_host
|
||||
)
|
||||
|
||||
notifies :restart, "service[#{node['openstack']['dashboard']['server_type']}]", :delayed
|
||||
notifies :restart, 'service[apache2]', :delayed
|
||||
end
|
||||
|
||||
execute 'openstack-dashboard syncdb' do
|
||||
cwd node['openstack']['dashboard']['django_path']
|
||||
environment 'PYTHONPATH' => "/etc/openstack-dashboard:#{node['openstack']['dashboard']['django_path']}:$PYTHONPATH"
|
||||
cwd django_path
|
||||
environment 'PYTHONPATH' => "/etc/openstack-dashboard:#{django_path}:$PYTHONPATH"
|
||||
command 'python manage.py syncdb --noinput'
|
||||
action :run
|
||||
only_if do
|
||||
|
@ -113,6 +114,13 @@ package 'openstack-dashboard-ubuntu-theme' do
|
|||
only_if { platform_family?('debian') }
|
||||
end
|
||||
|
||||
# TODO(shep)
|
||||
# Horizon has a forced dependency on there being a volume service endpoint in your keystone catalog
|
||||
# https://answers.launchpad.net/horizon/+question/189551
|
||||
# resource can be triggered from other recipes (e.g. in
|
||||
# recipe/neutron-lbaas-dashboard.rb)
|
||||
execute 'openstack-dashboard collectstatic' do
|
||||
cwd django_path
|
||||
environment 'PYTHONPATH' => "/etc/openstack-dashboard:#{django_path}:$PYTHONPATH"
|
||||
command 'python manage.py collectstatic --noinput'
|
||||
action :nothing
|
||||
end
|
||||
|
||||
include_recipe 'openstack-dashboard::apache2-server'
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
# encoding: UTF-8
|
||||
#
|
||||
# Cookbook Name:: openstack-dashboard
|
||||
# Recipe:: neutron-lbaas-dashboard
|
||||
#
|
||||
# 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.
|
||||
|
||||
include_recipe 'openstack-dashboard::horizon'
|
||||
|
||||
python_runtime '2'
|
||||
|
||||
django_path = node['openstack']['dashboard']['django_path']
|
||||
|
||||
python_package 'neutron-lbaas-dashboard' do
|
||||
version node['openstack']['dashboard']['lbaas']['version']
|
||||
notifies :run, 'execute[openstack-dashboard collectstatic]'
|
||||
end
|
||||
|
||||
remote_file "#{django_path}/openstack_dashboard/local/enabled/_1481_project_ng_loadbalancersv2_panel.py" do
|
||||
source 'https://raw.githubusercontent.com/openstack/neutron-lbaas-dashboard/stable/mitaka/neutron_lbaas_dashboard/enabled/_1481_project_ng_loadbalancersv2_panel.py'
|
||||
owner 'root'
|
||||
mode 00644
|
||||
notifies :run, 'execute[openstack-dashboard collectstatic]'
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
# encoding: UTF-8
|
||||
#
|
||||
# Cookbook Name:: openstack-dashboard
|
||||
# Recipe:: server
|
||||
#
|
||||
# Copyright 2012, Rackspace US, Inc.
|
||||
# Copyright 2012-2013, AT&T Services, Inc.
|
||||
# Copyright 2013-2014, IBM, Corp.
|
||||
# Copyright 2014, SUSE Linux, GmbH.
|
||||
# Copyright 2014, x-ion GmbH.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
include_recipe 'openstack-dashboard::horizon'
|
||||
include_recipe "openstack-dashboard::#{node['openstack']['dashboard']['server_type']}-server"
|
|
@ -6,7 +6,7 @@ describe 'openstack-dashboard::horizon' do
|
|||
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) do
|
||||
runner.converge('openstack-dashboard::server')
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
|
||||
include_context 'dashboard_stubs'
|
||||
|
|
|
@ -6,12 +6,12 @@ describe 'openstack-dashboard::horizon' do
|
|||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) do
|
||||
runner.converge('openstack-dashboard::server')
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
|
||||
let(:chef_run_session_sql) do
|
||||
node.set['openstack']['dashboard']['session_backend'] = 'sql'
|
||||
runner.converge('openstack-dashboard::server')
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
|
||||
include_context 'non_redhat_stubs'
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
# encoding: UTF-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-dashboard::neutron-lbaas-dashboard' do
|
||||
describe 'ubuntu' do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) do
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
|
||||
include_context 'non_redhat_stubs'
|
||||
include_context 'dashboard_stubs'
|
||||
|
||||
it do
|
||||
expect(chef_run).to include_recipe('openstack-dashboard::horizon')
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to install_python_runtime('2')
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to install_python_package('neutron-lbaas-dashboard')
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to create_remote_file(
|
||||
'/usr/share/openstack-dashboard/openstack_dashboard/local/enabled/_1481_project_ng_loadbalancersv2_panel.py'
|
||||
).with(
|
||||
mode: 00644,
|
||||
owner: 'root',
|
||||
source: 'https://raw.githubusercontent.com/openstack/neutron-lbaas-dashboard/stable/mitaka/neutron_lbaas_dashboard/enabled/_1481_project_ng_loadbalancersv2_panel.py'
|
||||
)
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run.remote_file('/usr/share/openstack-dashboard/openstack_dashboard/local/enabled/_1481_project_ng_loadbalancersv2_panel.py'))
|
||||
.to notify('execute[openstack-dashboard collectstatic]')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,21 +0,0 @@
|
|||
# encoding: UTF-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-dashboard::server' do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) do
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
|
||||
include_context 'non_redhat_stubs'
|
||||
include_context 'dashboard_stubs'
|
||||
|
||||
it 'installs the horizon dashboard' do
|
||||
expect(chef_run).to include_recipe('openstack-dashboard::horizon')
|
||||
end
|
||||
|
||||
it 'by default installs the apache2 webserver' do
|
||||
expect(chef_run).to include_recipe('openstack-dashboard::apache2-server')
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue