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