CentOS 8 support
- Update package names - Migrate to using apache2_mod_wsgi resource and require apache2 ~> 8.6 - Update ChefSpec Depends-On: https://review.opendev.org/c/openstack/cookbook-openstack-identity/+/815147 Change-Id: Ie94c860bc056349262325d2e90c513b64dbb3107 Signed-off-by: Lance Albertson <lance@osuosl.org>
This commit is contained in:
parent
ac44b062b6
commit
de8fb53dc0
|
@ -36,7 +36,7 @@ Cookbooks
|
|||
|
||||
The following cookbooks are dependencies:
|
||||
|
||||
- 'apache2', '~> 8.1'
|
||||
- 'apache2', '~> 8.6'
|
||||
- 'openstack-common', '>= 20.0.0'
|
||||
- 'openstack-identity', '>= 20.0.0'
|
||||
|
||||
|
|
|
@ -111,8 +111,8 @@ when 'rhel'
|
|||
default['openstack']['dashboard']['logout_url'] = "#{node['openstack']['dashboard']['webroot']}auth/logout/"
|
||||
default['openstack']['dashboard']['login_redirect_url'] = node['openstack']['dashboard']['webroot']
|
||||
default['openstack']['dashboard']['platform'] = {
|
||||
'horizon_packages' => %w(openstack-dashboard mod_wsgi),
|
||||
'memcache_python_packages' => %w(python-memcached),
|
||||
'horizon_packages' => %w(openstack-dashboard),
|
||||
'memcache_python_packages' => node['platform_version'].to_i >= 8 ? %w(python3-memcached) : %w(python-memcached),
|
||||
'package_overrides' => '',
|
||||
}
|
||||
when 'debian'
|
||||
|
@ -133,7 +133,6 @@ when 'debian'
|
|||
default['openstack']['dashboard']['platform']['horizon_packages'] =
|
||||
%w(
|
||||
node-less
|
||||
libapache2-mod-wsgi-py3
|
||||
python3-django-horizon
|
||||
openstack-dashboard
|
||||
)
|
||||
|
|
|
@ -9,7 +9,7 @@ version '20.0.0'
|
|||
supports os
|
||||
end
|
||||
|
||||
depends 'apache2', '~> 8.1'
|
||||
depends 'apache2', '~> 8.6'
|
||||
depends 'openstack-common', '>= 20.0.0'
|
||||
depends 'openstack-identity', '>= 20.0.0'
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ else
|
|||
end
|
||||
end
|
||||
|
||||
apache2_module 'wsgi'
|
||||
apache2_mod_wsgi 'dashboard'
|
||||
apache2_module 'rewrite'
|
||||
apache2_module 'headers'
|
||||
apache2_module 'ssl' if node['openstack']['dashboard']['use_ssl']
|
||||
|
|
|
@ -1,67 +1,69 @@
|
|||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-dashboard::apache2-server' do
|
||||
describe 'redhat' do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
cached(:chef_run) do
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
include_context 'dashboard_stubs'
|
||||
include_context 'redhat_stubs'
|
||||
ALL_RHEL.each do |p|
|
||||
context "redhat #{p[:version]}" do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(p) }
|
||||
let(:node) { runner.node }
|
||||
cached(:chef_run) do
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
include_context 'dashboard_stubs'
|
||||
include_context 'redhat_stubs'
|
||||
|
||||
describe 'certs' do
|
||||
describe 'get secret' do
|
||||
let(:pem) { chef_run.file('/etc/pki/tls/certs/horizon.pem') }
|
||||
let(:key) { chef_run.file('/etc/pki/tls/private/horizon.key') }
|
||||
describe 'certs' do
|
||||
describe 'get secret' do
|
||||
let(:pem) { chef_run.file('/etc/pki/tls/certs/horizon.pem') }
|
||||
let(:key) { chef_run.file('/etc/pki/tls/private/horizon.key') }
|
||||
|
||||
it 'create files and restarts apache' do
|
||||
expect(chef_run).to create_file('/etc/pki/tls/certs/horizon.pem').with(
|
||||
user: 'root',
|
||||
group: 'root',
|
||||
mode: '644'
|
||||
)
|
||||
expect(chef_run).to create_file('/etc/pki/tls/private/horizon.key').with(
|
||||
user: 'root',
|
||||
group: 'root',
|
||||
mode: '640'
|
||||
)
|
||||
end
|
||||
|
||||
context 'does not mess with certs if ssl not enabled' do
|
||||
cached(:chef_run) do
|
||||
node.override['openstack']['dashboard']['use_ssl'] = false
|
||||
runner.converge(described_recipe)
|
||||
it 'create files and restarts apache' do
|
||||
expect(chef_run).to create_file('/etc/pki/tls/certs/horizon.pem').with(
|
||||
user: 'root',
|
||||
group: 'root',
|
||||
mode: '644'
|
||||
)
|
||||
expect(chef_run).to create_file('/etc/pki/tls/private/horizon.key').with(
|
||||
user: 'root',
|
||||
group: 'root',
|
||||
mode: '640'
|
||||
)
|
||||
end
|
||||
it do
|
||||
expect(chef_run).not_to create_file('/etc/ssl/certs/horizon.pem')
|
||||
expect(chef_run).not_to create_file('/etc/pki/tls/private/horizon.key')
|
||||
|
||||
context 'does not mess with certs if ssl not enabled' do
|
||||
cached(:chef_run) do
|
||||
node.override['openstack']['dashboard']['use_ssl'] = false
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
it do
|
||||
expect(chef_run).not_to create_file('/etc/ssl/certs/horizon.pem')
|
||||
expect(chef_run).not_to create_file('/etc/pki/tls/private/horizon.key')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
it 'deletes openstack-dashboard.conf' do
|
||||
file = '/etc/httpd/conf.d/openstack-dashboard.conf'
|
||||
expect(chef_run).to delete_file(file)
|
||||
end
|
||||
it 'deletes openstack-dashboard.conf' do
|
||||
file = '/etc/httpd/conf.d/openstack-dashboard.conf'
|
||||
expect(chef_run).to delete_file(file)
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to_not disable_apache2_site('000-default')
|
||||
end
|
||||
it do
|
||||
expect(chef_run).to_not disable_apache2_site('000-default')
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to disable_apache2_site('default')
|
||||
end
|
||||
it do
|
||||
expect(chef_run).to disable_apache2_site('default')
|
||||
end
|
||||
|
||||
it 'sets the WSGI daemon user to attribute default' do
|
||||
file = chef_run.template('/etc/httpd/sites-available/openstack-dashboard.conf')
|
||||
expect(chef_run).to render_file(file.name).with_content('WSGIDaemonProcess dashboard user=apache')
|
||||
end
|
||||
it 'sets the WSGI daemon user to attribute default' do
|
||||
file = chef_run.template('/etc/httpd/sites-available/openstack-dashboard.conf')
|
||||
expect(chef_run).to render_file(file.name).with_content('WSGIDaemonProcess dashboard user=apache')
|
||||
end
|
||||
|
||||
it 'has correct ownership on file with attribute defaults' do
|
||||
file = chef_run.file('/usr/share/openstack-dashboard/openstack_dashboard/local/.secret_key_store')
|
||||
expect(file.owner).to eq('apache')
|
||||
expect(file.group).to eq('apache')
|
||||
it 'has correct ownership on file with attribute defaults' do
|
||||
file = chef_run.file('/usr/share/openstack-dashboard/openstack_dashboard/local/.secret_key_store')
|
||||
expect(file.owner).to eq('apache')
|
||||
expect(file.group).to eq('apache')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -79,7 +79,7 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
end
|
||||
|
||||
it 'enables apache modules' do
|
||||
expect(chef_run).to enable_apache2_module('wsgi')
|
||||
expect(chef_run).to create_apache2_mod_wsgi 'dashboard'
|
||||
expect(chef_run).to enable_apache2_module('rewrite')
|
||||
expect(chef_run).to enable_apache2_module('headers')
|
||||
end
|
||||
|
|
|
@ -1,44 +1,53 @@
|
|||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-dashboard::horizon' do
|
||||
describe 'redhat' do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
cached(:chef_run) do
|
||||
runner.converge('openstack-identity::server-apache', described_recipe)
|
||||
end
|
||||
|
||||
include_context 'dashboard_stubs'
|
||||
include_context 'redhat_stubs'
|
||||
|
||||
it 'installs packages' do
|
||||
expect(chef_run).to upgrade_package %w(openstack-dashboard mod_wsgi MySQL-python)
|
||||
end
|
||||
|
||||
describe 'local_settings' do
|
||||
let(:file) { chef_run.template('/etc/openstack-dashboard/local_settings') }
|
||||
|
||||
it 'creates local_settings' do
|
||||
expect(chef_run).to create_template(file.name).with(
|
||||
user: 'root',
|
||||
group: 'apache',
|
||||
mode: '640'
|
||||
)
|
||||
ALL_RHEL.each do |p|
|
||||
context "redhat #{p[:version]}" do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(p) }
|
||||
let(:node) { runner.node }
|
||||
cached(:chef_run) do
|
||||
runner.converge('openstack-identity::server-apache', described_recipe)
|
||||
end
|
||||
|
||||
it 'has urls set' do
|
||||
[
|
||||
%r{^LOGIN_URL = '/auth/login/'$},
|
||||
%r{^LOGOUT_URL = '/auth/logout/'$},
|
||||
%r{^LOGIN_REDIRECT_URL = '/'$},
|
||||
].each do |line|
|
||||
expect(chef_run).to render_file(file.name).with_content(line)
|
||||
include_context 'dashboard_stubs'
|
||||
include_context 'redhat_stubs'
|
||||
|
||||
case p
|
||||
when REDHAT_7
|
||||
it 'installs packages' do
|
||||
expect(chef_run).to upgrade_package %w(openstack-dashboard MySQL-python)
|
||||
end
|
||||
when REDHAT_8
|
||||
it 'installs packages' do
|
||||
expect(chef_run).to upgrade_package %w(openstack-dashboard python3-PyMySQL)
|
||||
end
|
||||
end
|
||||
|
||||
it 'has policy file path set' do
|
||||
expect(chef_run).to render_file(file.name)
|
||||
.with_content(%r{^POLICY_FILES_PATH = '/etc/openstack-dashboard'$})
|
||||
describe 'local_settings' do
|
||||
let(:file) { chef_run.template('/etc/openstack-dashboard/local_settings') }
|
||||
|
||||
it 'creates local_settings' do
|
||||
expect(chef_run).to create_template(file.name).with(
|
||||
user: 'root',
|
||||
group: 'apache',
|
||||
mode: '640'
|
||||
)
|
||||
end
|
||||
|
||||
it 'has urls set' do
|
||||
[
|
||||
%r{^LOGIN_URL = '/auth/login/'$},
|
||||
%r{^LOGOUT_URL = '/auth/logout/'$},
|
||||
%r{^LOGIN_REDIRECT_URL = '/'$},
|
||||
].each do |line|
|
||||
expect(chef_run).to render_file(file.name).with_content(line)
|
||||
end
|
||||
end
|
||||
|
||||
it 'has policy file path set' do
|
||||
expect(chef_run).to render_file(file.name)
|
||||
.with_content(%r{^POLICY_FILES_PATH = '/etc/openstack-dashboard'$})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -57,7 +57,7 @@ describe 'openstack-dashboard::horizon' do
|
|||
include_context 'dashboard_stubs'
|
||||
|
||||
it 'installs packages' do
|
||||
expect(chef_run).to upgrade_package %w(node-less libapache2-mod-wsgi-py3 python3-django-horizon openstack-dashboard python3-mysqldb)
|
||||
expect(chef_run).to upgrade_package %w(node-less python3-django-horizon openstack-dashboard python3-mysqldb)
|
||||
end
|
||||
|
||||
describe 'local_settings.py' do
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-dashboard::neutron-lbaas-dashboard' do
|
||||
describe 'redhat' do
|
||||
cached(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
|
||||
cached(:node) { runner.node }
|
||||
cached(:chef_run) do
|
||||
runner.converge('openstack-identity::server-apache', described_recipe)
|
||||
end
|
||||
ALL_RHEL.each do |p|
|
||||
context "redhat #{p[:version]}" do
|
||||
cached(:runner) { ChefSpec::SoloRunner.new(p) }
|
||||
cached(:node) { runner.node }
|
||||
cached(:chef_run) do
|
||||
runner.converge('openstack-identity::server-apache', described_recipe)
|
||||
end
|
||||
|
||||
include_context 'redhat_stubs'
|
||||
include_context 'dashboard_stubs'
|
||||
include_context 'redhat_stubs'
|
||||
include_context 'dashboard_stubs'
|
||||
|
||||
it do
|
||||
expect(chef_run).to include_recipe('openstack-dashboard::horizon')
|
||||
end
|
||||
it do
|
||||
expect(chef_run).to include_recipe('openstack-dashboard::horizon')
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to install_package('openstack-neutron-lbaas-ui')
|
||||
it do
|
||||
expect(chef_run).to install_package('openstack-neutron-lbaas-ui')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,10 +7,21 @@ RSpec.configure do |config|
|
|||
config.log_level = :warn
|
||||
end
|
||||
|
||||
REDHAT_OPTS = {
|
||||
REDHAT_7 = {
|
||||
platform: 'redhat',
|
||||
version: '7',
|
||||
}.freeze
|
||||
|
||||
REDHAT_8 = {
|
||||
platform: 'redhat',
|
||||
version: '8',
|
||||
}.freeze
|
||||
|
||||
ALL_RHEL = [
|
||||
REDHAT_7,
|
||||
REDHAT_8,
|
||||
].freeze
|
||||
|
||||
UBUNTU_OPTS = {
|
||||
platform: 'ubuntu',
|
||||
version: '18.04',
|
||||
|
|
Loading…
Reference in New Issue