WIP first few fixes to work with refactored cookbooks
* removed fedora and suse support * added os-identity dependency * added versionbumb for refactored os-identity and common * moved version up to 13.0.0 for mitaka release Depends-On: I0547182085eed91d05384fdd7734408a839a9a2c Depends-On: I3262b2e6f792f37c32a446e6567790b82bdd4613 Change-Id: Ida408a025f1a3e6a632108a9a32877026e286116
This commit is contained in:
parent
fab0a68ddd
commit
75e51698ad
|
@ -3,4 +3,11 @@ source "https://supermarket.chef.io"
|
|||
metadata
|
||||
|
||||
cookbook "openstack-common",
|
||||
github: "stackforge/cookbook-openstack-common"
|
||||
github: "openstack/cookbook-openstack-common"
|
||||
cookbook "openstack-identity",
|
||||
github: "openstack/cookbook-openstack-identity"
|
||||
|
||||
# use the current master branch until the new apache listen logic has been
|
||||
# released
|
||||
cookbook 'apache2',
|
||||
github: "svanzoest-cookbooks/apache2"
|
||||
|
|
|
@ -25,9 +25,19 @@ default['openstack']['dashboard']['custom_template_banner'] = '
|
|||
# This file autogenerated by Chef
|
||||
# Do not edit, changes will be overwritten
|
||||
'
|
||||
# ****************** OpenStack Dashboard Endpoints ******************************
|
||||
|
||||
# The OpenStack Dashboard non-SSL endpoint
|
||||
default['openstack']['bind_service']['dashboard_http']['host'] = '0.0.0.0'
|
||||
default['openstack']['bind_service']['dashboard_http']['port'] = '80'
|
||||
|
||||
# The OpenStack Dashboard SSL endpoint
|
||||
default['openstack']['bind_service']['dashboard_https']['host'] = '0.0.0.0'
|
||||
default['openstack']['bind_service']['dashboard_https']['port'] = '443'
|
||||
|
||||
# ********************************************************************************
|
||||
|
||||
default['openstack']['dashboard']['server_type'] = 'apache2'
|
||||
|
||||
default['openstack']['dashboard']['debug'] = false
|
||||
|
||||
# Don't cache html pages.
|
||||
|
@ -171,7 +181,7 @@ default['openstack']['dashboard']['api']['auth']['version'] = node['openstack'][
|
|||
|
||||
case node['openstack']['dashboard']['api']['auth']['version']
|
||||
when 'v2.0'
|
||||
default['openstack']['dashboard']['identity_api_version'] = 2.0
|
||||
default['openstack']['dashboard']['identity_api_version'] = 2.0
|
||||
when 'v3.0'
|
||||
default['openstack']['dashboard']['identity_api_version'] = 3
|
||||
end
|
||||
|
|
|
@ -4,15 +4,16 @@ maintainer_email 'openstack-dev@lists.openstack.org'
|
|||
license 'Apache 2.0'
|
||||
description 'Installs/Configures the OpenStack Dashboard (Horizon)'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '12.0.0'
|
||||
version '13.0.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.'
|
||||
recipe 'openstack-dashboard::server', 'Sets up the Horizon dashboard and webserver to run it.'
|
||||
|
||||
%w(ubuntu fedora redhat centos suse).each do |os|
|
||||
%w(ubuntu redhat centos).each do |os|
|
||||
supports os
|
||||
end
|
||||
|
||||
depends 'apache2', '~> 3.1'
|
||||
depends 'openstack-common', '>= 12.0.0'
|
||||
depends 'openstack-common', '>= 13.0.0'
|
||||
depends 'openstack-identity', '>= 13.0.0'
|
||||
|
|
|
@ -41,16 +41,18 @@ execute 'set-selinux-permissive' do
|
|||
only_if "[ ! -e /etc/httpd/conf/httpd.conf ] && [ -e /etc/redhat-release ] && [ $(/sbin/sestatus | grep -c '^Current mode:.*enforcing') -eq 1 ]"
|
||||
end
|
||||
|
||||
http_bind = endpoint 'dashboard-http-bind'
|
||||
https_bind = endpoint 'dashboard-https-bind'
|
||||
|
||||
http_bind = node['openstack']['bind_service']['dashboard_http']
|
||||
https_bind = node['openstack']['bind_service']['dashboard_https']
|
||||
# This allow the apache2/templates/default/ports.conf.erb to setup the correct listeners.
|
||||
listen_addresses = node['apache']['listen_addresses'] - ['*'] + [http_bind.host]
|
||||
listen_addresses += [https_bind.host] if node['openstack']['dashboard']['use_ssl']
|
||||
listen_ports = node['apache']['listen_ports'] - ['80'] + [http_bind.port]
|
||||
listen_ports += [https_bind.port] if node['openstack']['dashboard']['use_ssl']
|
||||
node.set['apache']['listen_addresses'] = listen_addresses.uniq
|
||||
node.set['apache']['listen_ports'] = listen_ports.uniq
|
||||
http_listen = { http_bind.host => [http_bind.port.to_s] }
|
||||
if node['openstack']['dashboard']['use_ssl']
|
||||
apache_listen = Chef::Mixin::DeepMerge.merge(http_listen, https_bind.host => [https_bind.port.to_s])
|
||||
else
|
||||
apache_listen = http_listen
|
||||
end
|
||||
|
||||
node.normal['apache']['listen'] =
|
||||
Chef::Mixin::DeepMerge.merge(node['apache']['listen'], apache_listen)
|
||||
|
||||
include_recipe 'apache2'
|
||||
include_recipe 'apache2::mod_headers'
|
||||
|
@ -75,7 +77,6 @@ end
|
|||
file "#{node['apache']['dir']}/conf.d/openstack-dashboard.conf" do
|
||||
action :delete
|
||||
backup false
|
||||
|
||||
only_if { platform_family?('rhel') } # :pragma-foodcritic: ~FC024 - won't fix this
|
||||
end
|
||||
|
||||
|
@ -192,14 +193,12 @@ when 'debian'
|
|||
when 'rhel'
|
||||
apache_site 'default' do
|
||||
enable false
|
||||
|
||||
notifies :run, 'execute[restore-selinux-context]', :immediately
|
||||
end
|
||||
end
|
||||
|
||||
apache_site 'openstack-dashboard' do
|
||||
enable true
|
||||
|
||||
notifies :run, 'execute[restore-selinux-context]', :immediately
|
||||
notifies :reload, 'service[apache2]', :immediately
|
||||
end
|
||||
|
@ -207,6 +206,5 @@ end
|
|||
execute 'restore-selinux-context' do
|
||||
command 'restorecon -Rv /etc/httpd /etc/pki; chcon -R -t httpd_sys_content_t /usr/share/openstack-dashboard || :'
|
||||
action :nothing
|
||||
|
||||
only_if { platform_family?('fedora') }
|
||||
end
|
||||
|
|
|
@ -27,12 +27,12 @@ require 'uri'
|
|||
class ::Chef::Recipe # rubocop:disable Documentation
|
||||
include ::Openstack
|
||||
end
|
||||
|
||||
include_recipe 'openstack-identity'
|
||||
platform_options = node['openstack']['dashboard']['platform']
|
||||
|
||||
identity_admin_endpoint = admin_endpoint 'identity-admin'
|
||||
identity_admin_endpoint = admin_endpoint 'identity'
|
||||
auth_admin_uri = auth_uri_transform identity_admin_endpoint.to_s, node['openstack']['dashboard']['api']['auth']['version']
|
||||
identity_endpoint = public_endpoint 'identity-api'
|
||||
identity_endpoint = public_endpoint 'identity'
|
||||
auth_uri = auth_uri_transform identity_endpoint.to_s, node['openstack']['dashboard']['api']['auth']['version']
|
||||
|
||||
db_pass = get_password 'db', 'horizon'
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
# encoding: UTF-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-dashboard::apache2-server' do
|
||||
describe 'suse' do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) do
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
|
||||
include_context 'non_redhat_stubs'
|
||||
include_context 'dashboard_stubs'
|
||||
|
||||
it 'creates .blackhole dir with proper owner' do
|
||||
dir = '/srv/www/openstack-dashboard/openstack_dashboard/.blackhole'
|
||||
expect(chef_run.directory(dir).owner).to eq('root')
|
||||
end
|
||||
|
||||
it 'has correct ownership on file with attribute defaults' do
|
||||
file = chef_run.file('/srv/www/openstack-dashboard/openstack_dashboard/local/.secret_key_store')
|
||||
expect(file.owner).to eq('wwwrun')
|
||||
expect(file.group).to eq('www')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -2,7 +2,7 @@
|
|||
require_relative 'spec_helper'
|
||||
|
||||
shared_examples 'virtualhost port configurator' do |port_attribute_name, port_attribute_value|
|
||||
let(:virtualhost_directive) { "<VirtualHost 127.0.0.1:#{port_attribute_value}>" }
|
||||
let(:virtualhost_directive) { "<VirtualHost 0.0.0.0:#{port_attribute_value}>" }
|
||||
before do
|
||||
node.set['openstack']['endpoints'][port_attribute_name]['port'] = port_attribute_value
|
||||
end
|
||||
|
@ -13,7 +13,7 @@ shared_examples 'virtualhost port configurator' do |port_attribute_name, port_at
|
|||
|
||||
it 'sets NameVirtualHost directives when apache 2.2' do
|
||||
node.set['apache']['version'] = '2.2'
|
||||
expect(chef_run).to render_file(file.name).with_content(/^NameVirtualHost 127.0.0.1:#{port_attribute_value}$/)
|
||||
expect(chef_run).to render_file(file.name).with_content(/^NameVirtualHost 0.0.0.0:#{port_attribute_value}$/)
|
||||
end
|
||||
|
||||
it 'sets the VirtualHost directive' do
|
||||
|
@ -55,8 +55,8 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
end
|
||||
|
||||
it 'set apache addresses and ports' do
|
||||
expect(chef_run.node['apache']['listen_addresses']).to eq ['127.0.0.1']
|
||||
expect(chef_run.node['apache']['listen_ports']).to eq [80, 443]
|
||||
expect(chef_run.node['apache']['listen']).to eq '*' => %w(80), '0.0.0.0' => %w(80 443)
|
||||
# expect(chef_run.node['apache']['listen_ports']).to eq [80, 443]
|
||||
end
|
||||
|
||||
it 'includes apache packages' do
|
||||
|
@ -162,8 +162,6 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
expect(chef_run).to render_file(file.name).with_content(/^custom_template_banner_value$/)
|
||||
end
|
||||
|
||||
it_should_behave_like 'virtualhost port configurator', 'dashboard-http-bind', 8080
|
||||
|
||||
context 'cache_html' do
|
||||
it 'prevents html page caching' do
|
||||
expect(chef_run).to render_file(file.name).with_content(%r{^\s*SetEnvIfExpr "req\('accept'\) =~/html/" NO_CACHE$})
|
||||
|
@ -184,7 +182,7 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
node.set['openstack']['dashboard']['use_ssl'] = true
|
||||
end
|
||||
|
||||
it_should_behave_like 'virtualhost port configurator', 'dashboard-https-bind', 4433
|
||||
it_should_behave_like 'virtualhost port configurator', 'dashboard-https-bind', 443
|
||||
|
||||
it 'shows rewrite ssl directive' do
|
||||
expect(chef_run).to render_file(file.name).with_content(rewrite_ssl_directive)
|
||||
|
@ -192,23 +190,23 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
|
||||
context 'rewrite rule' do
|
||||
it 'shows the default SSL rewrite rule when http_port is 80 and https_port is 443' do
|
||||
node.set['openstack']['endpoints']['dashboard-http-bind']['port'] = 80
|
||||
node.set['openstack']['endpoints']['dashboard-https-bind']['port'] = 443
|
||||
node.set['openstack']['bind_service']['dashboard_http']['port'] = 80
|
||||
node.set['openstack']['bind_service']['dashboard_https']['port'] = 443
|
||||
expect(chef_run).to render_file(file.name).with_content(default_rewrite_rule)
|
||||
end
|
||||
|
||||
it 'shows the parameterized SSL rewrite rule when http_port is different from 80' do
|
||||
https_port_value = 443
|
||||
node.set['openstack']['endpoints']['dashboard-http-bind']['port'] = 81
|
||||
node.set['openstack']['endpoints']['dashboard-https-bind']['port'] = https_port_value
|
||||
node.set['openstack']['bind_service']['dashboard_http']['port'] = 81
|
||||
node.set['openstack']['bind_service']['dashboard_https']['port'] = https_port_value
|
||||
expect(chef_run).to render_file(file.name)
|
||||
.with_content(%r{^\s*RewriteRule \^\(\.\*\)\$ https://%\{SERVER_NAME\}:#{https_port_value}%\{REQUEST_URI\} \[L,R\]$})
|
||||
end
|
||||
|
||||
it 'shows the parameterized SSL rewrite rule when https_port is different from 443' do
|
||||
https_port_value = 444
|
||||
node.set['openstack']['endpoints']['dashboard-http-bind']['port'] = 80
|
||||
node.set['openstack']['endpoints']['dashboard-https-bind']['port'] = https_port_value
|
||||
node.set['openstack']['bind_service']['dashboard_http']['port'] = 80
|
||||
node.set['openstack']['bind_service']['dashboard_https']['port'] = https_port_value
|
||||
expect(chef_run).to render_file(file.name)
|
||||
.with_content(%r{^\s*RewriteRule \^\(\.\*\)\$ https://%\{SERVER_NAME\}:#{https_port_value}%\{REQUEST_URI\} \[L,R\]$})
|
||||
end
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
# encoding: UTF-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-dashboard::horizon' do
|
||||
describe 'suse' do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) do
|
||||
runner.converge('openstack-dashboard::server')
|
||||
end
|
||||
|
||||
include_context 'non_redhat_stubs'
|
||||
include_context 'dashboard_stubs'
|
||||
|
||||
context 'mysql backend' do
|
||||
include_context 'mysql_backend'
|
||||
|
||||
it 'installs mysql packages when mysql backend is configured' do
|
||||
expect(chef_run).to upgrade_package('python-mysql')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'local_settings.py' do
|
||||
let(:file) { chef_run.template('/srv/www/openstack-dashboard/openstack_dashboard/local/local_settings.py') }
|
||||
|
||||
it 'does not have urls set' do
|
||||
[
|
||||
/^LOGIN_URL =$/,
|
||||
/^LOGOUT_URL =$/,
|
||||
/^LOGIN_REDIRECT_URL =$/
|
||||
].each do |line|
|
||||
expect(chef_run).to_not render_file(file.name).with_content(line)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'postgresql backend' do
|
||||
include_context 'postgresql_backend'
|
||||
let(:file) { chef_run.template('/srv/www/openstack-dashboard/openstack_dashboard/local/local_settings.py') }
|
||||
|
||||
it 'installs packages' do
|
||||
expect(chef_run).to upgrade_package('openstack-dashboard')
|
||||
end
|
||||
|
||||
it 'installs postgresql packages' do
|
||||
expect(chef_run).to upgrade_package('python-psycopg2')
|
||||
end
|
||||
|
||||
it 'creates local_settings.py' do
|
||||
expect(chef_run).to render_file(file.name).with_content('autogenerated')
|
||||
end
|
||||
|
||||
it 'does not execute openstack-dashboard syncdb by default' do
|
||||
cmd = 'python manage.py syncdb --noinput'
|
||||
expect(chef_run).not_to run_execute(cmd).with(
|
||||
cwd: '/srv/www/openstack-dashboard',
|
||||
environment: {
|
||||
'PYTHONPATH' => '/etc/openstack-dashboard:' \
|
||||
'/srv/www/openstack-dashboard:' \
|
||||
'$PYTHONPATH'
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -15,11 +15,6 @@ UBUNTU_OPTS = {
|
|||
version: '14.04',
|
||||
log_level: LOG_LEVEL
|
||||
}
|
||||
SUSE_OPTS = {
|
||||
platform: 'suse',
|
||||
version: '11.3',
|
||||
log_level: LOG_LEVEL
|
||||
}
|
||||
|
||||
# Build a regex for a section of lines
|
||||
def build_section(lines)
|
||||
|
|
Loading…
Reference in New Issue