Stein fixes

- Cookstyle fixes
- Refactor Berksfile to use groups so we can exclude integration testing
  cookbooks
- Update documentation
- Cleanup line wraps
- Update delivery configuration to exclude integration cookbooks
- Fix ChefSpec output.
- Add missing ChefSpec tests
- Switch package installations to send packages as arrays instead of individual
  package resources. This generally speeds up chef runs.
- Cleanup array syntax using %w() instead of []
- Remove FWaaS recipe as it's been unmaintained upstream.

Depends-On: https://review.opendev.org/701027
Depends-On: https://review.opendev.org/706101
Depends-On: https://review.opendev.org/706151
Change-Id: Ie3b65b701235bae65a1797d63d6a55dd6fc9958e
This commit is contained in:
Lance Albertson 2020-03-18 16:59:39 -07:00
parent 4e4bed1eed
commit 57b9ab6138
16 changed files with 107 additions and 211 deletions

View File

@ -1 +1,9 @@
remote_file = "https://raw.githubusercontent.com/chef-cookbooks/community_cookbook_tools/master/delivery/project.toml" [local_phases]
unit = 'rspec spec/'
lint = 'cookstyle --display-cop-names --extra-details'
syntax = "berks install -e integration"
provision = "echo skipping"
deploy = "echo skipping"
smoke = "echo skipping"
functional = "echo skipping"
cleanup = "echo skipping"

View File

@ -14,26 +14,3 @@ AllCops:
- .cookbooks/**/* - .cookbooks/**/*
- berks-cookbooks/**/* - berks-cookbooks/**/*
- .bundle/**/* - .bundle/**/*
Encoding:
Exclude:
- metadata.rb
- Gemfile
NumericLiterals:
Enabled: false
LineLength:
Enabled: false
WordArray:
MinSize: 3
Style/Next:
Description: Use `next` to skip iteration instead of a condition at the end.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
Enabled: true
EnforcedStyle: always
SupportedStyles:
- skip_modifier_ifs
- always

View File

@ -2,21 +2,21 @@ source 'https://supermarket.chef.io'
solver :ruby, :required solver :ruby, :required
%w( [
client %w(client dep),
-common %w(-common dep),
-dns %w(-dns integration),
-identity %w(-identity dep),
-image %w(-image integration),
-integration-test %w(-integration-test integration),
-network %w(-network integration),
-ops-database %w(-ops-database integration),
-ops-messaging %w(-ops-messaging integration),
).each do |cookbook| ].each do |cookbook, group|
if Dir.exist?("../cookbook-openstack#{cookbook}") if Dir.exist?("../cookbook-openstack#{cookbook}")
cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}" cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}", group: group
else else
cookbook "openstack#{cookbook}", git: "https://opendev.org/openstack/cookbook-openstack#{cookbook}" cookbook "openstack#{cookbook}", git: "https://opendev.org/openstack/cookbook-openstack#{cookbook}", group: group
end end
end end

View File

@ -20,9 +20,9 @@ https://docs.openstack.org/horizon/latest/
Requirements Requirements
============ ============
- Chef 14 or higher - Chef 15 or higher
- ChefDK 3.2.30 for testing (also includes Berkshelf for cookbook - Chef Workstation 0.15.18 for testing (also includes Berkshelf for
dependency resolution) cookbook dependency resolution)
Platform Platform
======== ========
@ -37,8 +37,8 @@ Cookbooks
The following cookbooks are dependencies: The following cookbooks are dependencies:
- 'apache2', '~> 8.0' - 'apache2', '~> 8.0'
- 'openstack-common', '>= 18.0.0' - 'openstack-common', '>= 19.0.0'
- 'openstack-identity', '>= 18.0.0' - 'openstack-identity', '>= 19.0.0'
- 'poise-python' - 'poise-python'
Attributes Attributes
@ -64,12 +64,6 @@ openstack-dashboard::apache2-server
- Installs the Apache webserver and sets up an ``mod_wsgi`` container to - Installs the Apache webserver and sets up an ``mod_wsgi`` container to
run the Horizon dashboard. run the Horizon dashboard.
openstack-dashboard::neutron-fwaas-dashboard
--------------------------------------------
- Installs the python neutron-fwaas-dashboard package. Includes
openstack-dashboard::horizon recipe at the beginning.
openstack-dashboard::neutron-lbaas-dashboard openstack-dashboard::neutron-lbaas-dashboard
-------------------------------------------- --------------------------------------------
@ -134,7 +128,7 @@ License and Author
+-----------------+---------------------------------------------------+ +-----------------+---------------------------------------------------+
| **Copyright** | Copyright (c) 2014, x-ion GmbH. | | **Copyright** | Copyright (c) 2014, x-ion GmbH. |
+-----------------+---------------------------------------------------+ +-----------------+---------------------------------------------------+
| **Copyright** | Copyright (c) 2016-2019, Oregon State University | | **Copyright** | Copyright (c) 2016-2020, Oregon State University |
+-----------------+---------------------------------------------------+ +-----------------+---------------------------------------------------+
Licensed under the Apache License, Version 2.0 (the "License"); you may Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@ -1,10 +1,11 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-dashboard # Cookbook:: openstack-dashboard
# Attributes:: default # Attributes:: default
# #
# Copyright 2012, AT&T, Inc. # Copyright:: 2012, AT&T, Inc.
# Copyright 2013-2014, IBM, Corp. # Copyright:: 2013-2014, IBM, Corp.
# Copyright:: 2016-2020, Oregon State University
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -98,7 +99,8 @@ when 'rhel'
default['openstack']['dashboard']['key_group'] = 'root' default['openstack']['dashboard']['key_group'] = 'root'
default['openstack']['dashboard']['horizon_user'] = 'apache' default['openstack']['dashboard']['horizon_user'] = 'apache'
default['openstack']['dashboard']['horizon_group'] = 'apache' default['openstack']['dashboard']['horizon_group'] = 'apache'
default['openstack']['dashboard']['secret_key_path'] = '/usr/share/openstack-dashboard/openstack_dashboard/local/.secret_key_store' default['openstack']['dashboard']['secret_key_path'] =
'/usr/share/openstack-dashboard/openstack_dashboard/local/.secret_key_store'
default['openstack']['dashboard']['ssl']['cert_dir'] = '/etc/pki/tls/certs/' default['openstack']['dashboard']['ssl']['cert_dir'] = '/etc/pki/tls/certs/'
default['openstack']['dashboard']['ssl']['key_dir'] = '/etc/pki/tls/private/' default['openstack']['dashboard']['ssl']['key_dir'] = '/etc/pki/tls/private/'
default['openstack']['dashboard']['local_settings_path'] = '/etc/openstack-dashboard/local_settings' default['openstack']['dashboard']['local_settings_path'] = '/etc/openstack-dashboard/local_settings'
@ -109,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' => ['openstack-dashboard', 'mod_wsgi'], 'horizon_packages' => %w(openstack-dashboard mod_wsgi),
'memcache_python_packages' => ['python-memcached'], 'memcache_python_packages' => %w(python-memcached),
'package_overrides' => '', 'package_overrides' => '',
} }
when 'debian' when 'debian'
@ -128,11 +130,16 @@ when 'debian'
default['openstack']['dashboard']['logout_url'] = nil default['openstack']['dashboard']['logout_url'] = nil
default['openstack']['dashboard']['login_redirect_url'] = nil default['openstack']['dashboard']['login_redirect_url'] = nil
default['openstack']['dashboard']['platform'] = { default['openstack']['dashboard']['platform'] = {
'memcache_python_packages' => ['python3-memcache'], 'memcache_python_packages' => %w(python3-memcache),
'package_overrides' => '', 'package_overrides' => '',
} }
default['openstack']['dashboard']['platform']['horizon_packages'] = default['openstack']['dashboard']['platform']['horizon_packages'] =
['node-less', 'libapache2-mod-wsgi-py3', 'python3-django-horizon', 'openstack-dashboard'] %w(
node-less
libapache2-mod-wsgi-py3
python3-django-horizon
openstack-dashboard
)
else else
default['openstack']['dashboard']['key_group'] = 'root' default['openstack']['dashboard']['key_group'] = 'root'
end end
@ -196,7 +203,6 @@ default['openstack']['dashboard']['simple_ip_management'] = false
default['openstack']['dashboard']['neutron']['enable_quotas'] = true default['openstack']['dashboard']['neutron']['enable_quotas'] = true
default['openstack']['dashboard']['neutron']['enable_lb'] = false default['openstack']['dashboard']['neutron']['enable_lb'] = false
default['openstack']['dashboard']['neutron']['enable_vpn'] = false default['openstack']['dashboard']['neutron']['enable_vpn'] = false
default['openstack']['dashboard']['neutron']['enable_fwaas'] = false
# Allow for misc sections to be added to the local_settings template # Allow for misc sections to be added to the local_settings template
# For example: { # For example: {
# 'CUSTOM_CONFIG_A' => { # 'CUSTOM_CONFIG_A' => {

View File

@ -3,22 +3,17 @@ maintainer 'openstack-chef'
maintainer_email 'openstack-discuss@lists.openstack.org' maintainer_email 'openstack-discuss@lists.openstack.org'
license 'Apache-2.0' license 'Apache-2.0'
description 'Installs/Configures the OpenStack Dashboard (Horizon)' description 'Installs/Configures the OpenStack Dashboard (Horizon)'
version '18.0.0' version '19.0.0'
recipe 'horizon', 'Sets up the packages needed to run the Horizon dashboard and its dependencies.'
recipe 'apache2-server', 'Installs the Apache webserver to run the Horizon dashboard.'
recipe 'neutron-fwaas-dashboard', 'Installs the python neutron-fwaas-dashboard package.'
recipe 'neutron-lbaas-dashboard', 'Installs the python neutron-lbaas-dashboard package.'
%w(ubuntu redhat centos).each do |os| %w(ubuntu redhat centos).each do |os|
supports os supports os
end end
depends 'apache2', '~> 8.0' depends 'apache2', '~> 8.0'
depends 'openstack-common', '>= 18.0.0' depends 'openstack-common', '>= 19.0.0'
depends 'openstack-identity', '>= 18.0.0' depends 'openstack-identity', '>= 19.0.0'
depends 'poise-python' depends 'poise-python'
issues_url 'https://launchpad.net/openstack-chef' issues_url 'https://launchpad.net/openstack-chef'
source_url 'https://opendev.org/openstack/cookbook-openstack-dashboard' source_url 'https://opendev.org/openstack/cookbook-openstack-dashboard'
chef_version '>= 14.0' chef_version '>= 15.0'

View File

@ -1,13 +1,14 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-dashboard # Cookbook:: openstack-dashboard
# Recipe:: apache2-server # Recipe:: apache2-server
# #
# Copyright 2012, Rackspace US, Inc. # Copyright:: 2012, Rackspace US, Inc.
# Copyright 2012-2013, AT&T Services, Inc. # Copyright:: 2012-2013, AT&T Services, Inc.
# Copyright 2013-2014, IBM, Corp. # Copyright:: 2013-2014, IBM, Corp.
# Copyright 2014, SUSE Linux, GmbH. # Copyright:: 2014, SUSE Linux, GmbH.
# Copyright 2014, x-ion GmbH. # Copyright:: 2014, x-ion GmbH.
# Copyright:: 2016-2020, Oregon State University
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -83,16 +84,19 @@ if node['openstack']['dashboard']['ssl']['use_data_bag']
ssl_chain = secret('certs', node['openstack']['dashboard']['ssl']['chain']) ssl_chain = secret('certs', node['openstack']['dashboard']['ssl']['chain'])
end end
end end
ssl_cert_file = File.join(node['openstack']['dashboard']['ssl']['cert_dir'], node['openstack']['dashboard']['ssl']['cert']) ssl_cert_file =
ssl_key_file = File.join(node['openstack']['dashboard']['ssl']['key_dir'], node['openstack']['dashboard']['ssl']['key']) File.join(node['openstack']['dashboard']['ssl']['cert_dir'], node['openstack']['dashboard']['ssl']['cert'])
ssl_chain_file = if node['openstack']['dashboard']['ssl']['chain'] ssl_key_file =
File.join(node['openstack']['dashboard']['ssl']['cert_dir'], node['openstack']['dashboard']['ssl']['chain']) File.join(node['openstack']['dashboard']['ssl']['key_dir'], node['openstack']['dashboard']['ssl']['key'])
end ssl_chain_file =
if node['openstack']['dashboard']['ssl']['chain']
File.join(node['openstack']['dashboard']['ssl']['cert_dir'], node['openstack']['dashboard']['ssl']['chain'])
end
if node['openstack']['dashboard']['use_ssl'] && if node['openstack']['dashboard']['use_ssl'] &&
node['openstack']['dashboard']['ssl']['use_data_bag'] node['openstack']['dashboard']['ssl']['use_data_bag']
unless ssl_cert_file == ssl_key_file unless ssl_cert_file == ssl_key_file
cert_mode = 0o0644 cert_mode = '644'
cert_owner = 'root' cert_owner = 'root'
cert_group = 'root' cert_group = 'root'
@ -105,7 +109,7 @@ if node['openstack']['dashboard']['use_ssl'] &&
end end
if ssl_chain_file if ssl_chain_file
cert_mode = 0o0644 cert_mode = '644'
cert_owner = 'root' cert_owner = 'root'
cert_group = 'root' cert_group = 'root'
@ -117,7 +121,7 @@ if node['openstack']['dashboard']['use_ssl'] &&
end end
end end
key_mode = 0o0640 key_mode = '640'
key_owner = 'root' key_owner = 'root'
key_group = node['openstack']['dashboard']['key_group'] key_group = node['openstack']['dashboard']['key_group']
@ -133,7 +137,7 @@ end
file node['openstack']['dashboard']['secret_key_path'] do file node['openstack']['dashboard']['secret_key_path'] do
owner node['openstack']['dashboard']['horizon_user'] owner node['openstack']['dashboard']['horizon_user']
group node['openstack']['dashboard']['horizon_group'] group node['openstack']['dashboard']['horizon_group']
mode 0o0600 mode '600'
# the only time the file should be created is if we have secret_key_content # the only time the file should be created is if we have secret_key_content
# set, otherwise let apache create it when someone first accesses the # set, otherwise let apache create it when someone first accesses the
# dashboard # dashboard
@ -148,7 +152,6 @@ end
# stop apache bitching # stop apache bitching
directory "#{node['openstack']['dashboard']['dash_path']}/.blackhole" do directory "#{node['openstack']['dashboard']['dash_path']}/.blackhole" do
owner 'root' owner 'root'
action :create
end end
template "#{apache_dir}/sites-available/openstack-dashboard.conf" do template "#{apache_dir}/sites-available/openstack-dashboard.conf" do

View File

@ -1,13 +1,14 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-dashboard # Cookbook:: openstack-dashboard
# Recipe:: horizon # Recipe:: horizon
# #
# Copyright 2012, Rackspace US, Inc. # Copyright:: 2012, Rackspace US, Inc.
# Copyright 2012-2013, AT&T Services, Inc. # Copyright:: 2012-2013, AT&T Services, Inc.
# Copyright 2013-2014, IBM, Corp. # Copyright:: 2013-2014, IBM, Corp.
# Copyright 2014, SUSE Linux, GmbH. # Copyright:: 2014, SUSE Linux, GmbH.
# Copyright 2014, x-ion, GmbH. # Copyright:: 2014, x-ion, GmbH.
# Copyright:: 2019-2020, Oregon State University
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -38,11 +39,12 @@ http_bind_address = bind_address http_bind
https_bind = node['openstack']['bind_service']['dashboard_https'] https_bind = node['openstack']['bind_service']['dashboard_https']
https_bind_address = bind_address https_bind https_bind_address = bind_address https_bind
horizon_host = if node['openstack']['dashboard']['use_ssl'] horizon_host =
https_bind_address if node['openstack']['dashboard']['use_ssl']
else https_bind_address
http_bind_address else
end http_bind_address
end
db_pass = get_password 'db', 'horizon' db_pass = get_password 'db', 'horizon'
db_info = db 'dashboard' db_info = db 'dashboard'
@ -50,11 +52,9 @@ db_info = db 'dashboard'
python_packages = node['openstack']['db']['python_packages'][db_info['service_type']] python_packages = node['openstack']['db']['python_packages'][db_info['service_type']]
# Add dashboard specific database packages # Add dashboard specific database packages
python_packages += Array(node['openstack']['dashboard']['db_python_packages'][db_info['service_type']]) python_packages += Array(node['openstack']['dashboard']['db_python_packages'][db_info['service_type']])
(platform_options['horizon_packages'] + python_packages).each do |pkg| package platform_options['horizon_packages'] + python_packages do
package pkg do action :upgrade
action :upgrade options platform_options['package_overrides']
options platform_options['package_overrides']
end
end end
if node['openstack']['dashboard']['session_backend'] == 'memcached' if node['openstack']['dashboard']['session_backend'] == 'memcached'
@ -70,7 +70,7 @@ template node['openstack']['dashboard']['local_settings_path'] do
source 'local_settings.py.erb' source 'local_settings.py.erb'
owner 'root' owner 'root'
group node['openstack']['dashboard']['horizon_group'] group node['openstack']['dashboard']['horizon_group']
mode 0o0640 mode '640'
sensitive true sensitive true
variables( variables(
@ -99,8 +99,7 @@ end
directory "#{node['openstack']['dashboard']['dash_path']}/local" do directory "#{node['openstack']['dashboard']['dash_path']}/local" do
owner 'root' owner 'root'
group node['openstack']['dashboard']['horizon_group'] group node['openstack']['dashboard']['horizon_group']
mode 0o2770 mode '2770'
action :create
end end
# resource can be triggered from other recipes (e.g. in # resource can be triggered from other recipes (e.g. in
@ -123,7 +122,7 @@ secret_file =
file secret_file do file secret_file do
owner node['openstack']['dashboard']['horizon_user'] owner node['openstack']['dashboard']['horizon_user']
group node['openstack']['dashboard']['horizon_user'] group node['openstack']['dashboard']['horizon_user']
mode 0600 mode '600'
subscribes :create, 'service[apache2]', :immediately subscribes :create, 'service[apache2]', :immediately
only_if { ::File.exist?(secret_file) } only_if { ::File.exist?(secret_file) }
end end

View File

@ -1,58 +0,0 @@
# 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'
case node['platform_family']
when 'debian'
package 'python3-neutron-fwaas-dashboard'
when 'rhel'
django_path = node['openstack']['dashboard']['django_path']
policy_file_path = node['openstack']['dashboard']['policy_files_path']
python_package 'neutron-fwaas-dashboard'
%w(
_7010_project_firewalls_common.py
_7011_project_firewalls_panel.py
_7012_project_firewalls_v2_panel.py
).each do |file|
remote_file "#{django_path}/openstack_dashboard/local/enabled/#{file}" do
source "https://opendev.org/openstack/neutron-fwaas-dashboard/raw/branch/stable/rocky/neutron_fwaas_dashboard/enabled/#{file}"
owner 'root'
mode 0o0644
notifies :run, 'execute[neutron-fwaas-dashboard compilemessages]'
notifies :run, 'execute[openstack-dashboard collectstatic]'
end
end
remote_file "#{policy_file_path}/neutron-fwaas-policy.json" do
source 'https://opendev.org/openstack/neutron-fwaas-dashboard/raw/branch/stable/rocky/etc/neutron-fwaas-policy.json'
owner 'root'
mode 0o0644
notifies :run, 'execute[neutron-fwaas-dashboard compilemessages]'
notifies :run, 'execute[openstack-dashboard collectstatic]'
notifies :restart, 'service[apache2]', :delayed
end
execute 'neutron-fwaas-dashboard compilemessages' do
cwd django_path
environment 'PYTHONPATH' => "/etc/openstack-dashboard:#{django_path}:$PYTHONPATH"
command 'python manage.py compilemessages'
action :nothing
end
end

View File

@ -1,8 +1,10 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-dashboard # Cookbook:: openstack-dashboard
# Recipe:: neutron-lbaas-dashboard # Recipe:: neutron-lbaas-dashboard
# #
# Copyright:: 2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
@ -29,9 +31,9 @@ when 'rhel'
end end
remote_file "#{django_path}/openstack_dashboard/local/enabled/_1481_project_ng_loadbalancersv2_panel.py" do remote_file "#{django_path}/openstack_dashboard/local/enabled/_1481_project_ng_loadbalancersv2_panel.py" do
source 'https://opendev.org/openstack/neutron-lbaas-dashboard/raw/branch/stable/rocky/neutron_lbaas_dashboard/enabled/_1481_project_ng_loadbalancersv2_panel.py' source "https://opendev.org/openstack/neutron-lbaas-dashboard/raw/branch/stable/#{node['openstack']['release']}/neutron_lbaas_dashboard/enabled/_1481_project_ng_loadbalancersv2_panel.py"
owner 'root' owner 'root'
mode 0o0644 mode '644'
notifies :run, 'execute[openstack-dashboard collectstatic]' notifies :run, 'execute[openstack-dashboard collectstatic]'
end end
end end

View File

@ -20,12 +20,12 @@ describe 'openstack-dashboard::apache2-server' 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: 0o644 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: 0o640 mode: '640'
) )
end end

View File

@ -99,13 +99,13 @@ describe 'openstack-dashboard::apache2-server' do
content: 'horizon_pem_value', content: 'horizon_pem_value',
user: 'root', user: 'root',
group: 'root', group: 'root',
mode: 0o644 mode: '644'
) )
expect(chef_run).to create_file('/etc/ssl/private/horizon.key').with( expect(chef_run).to create_file('/etc/ssl/private/horizon.key').with(
content: 'horizon_key_value', content: 'horizon_key_value',
user: 'root', user: 'root',
group: 'ssl-cert', group: 'ssl-cert',
mode: 0o640 mode: '640'
) )
end end
end end
@ -117,7 +117,7 @@ describe 'openstack-dashboard::apache2-server' do
content: 'horizon_chain_pem_value', content: 'horizon_chain_pem_value',
user: 'root', user: 'root',
group: 'root', group: 'root',
mode: 0o644 mode: '644'
) )
end end
end end
@ -138,7 +138,7 @@ describe 'openstack-dashboard::apache2-server' do
content: 'horizon_pem_value', content: 'horizon_pem_value',
user: 'root', user: 'root',
group: 'root', group: 'root',
mode: 0o644 mode: '644'
) )
end end
@ -147,7 +147,7 @@ describe 'openstack-dashboard::apache2-server' do
content: 'horizon_pem_value', content: 'horizon_pem_value',
user: 'root', user: 'root',
group: 'ssl-cert', group: 'ssl-cert',
mode: 0o640 mode: '640'
) )
end end
@ -188,13 +188,13 @@ describe 'openstack-dashboard::apache2-server' do
content: 'any_pem_value', content: 'any_pem_value',
user: 'root', user: 'root',
group: 'root', group: 'root',
mode: 0o644 mode: '644'
) )
expect(chef_run).to create_file('/etc/anypath/any.key').with( expect(chef_run).to create_file('/etc/anypath/any.key').with(
content: 'any_key_value', content: 'any_key_value',
user: 'root', user: 'root',
group: 'ssl-cert', group: 'ssl-cert',
mode: 0o640 mode: '640'
) )
end end
describe 'set ssl chain' do describe 'set ssl chain' do
@ -204,7 +204,7 @@ describe 'openstack-dashboard::apache2-server' do
content: 'any_chain_pem_value', content: 'any_chain_pem_value',
user: 'root', user: 'root',
group: 'root', group: 'root',
mode: 0o644 mode: '644'
) )
end end
end end
@ -555,7 +555,7 @@ describe 'openstack-dashboard::apache2-server' do
end end
it 'has correct mode' do it 'has correct mode' do
expect(file.mode).to eq(0o0600) expect(file.mode).to eq('600')
end end
it 'does not notify apache2 restart' do it 'does not notify apache2 restart' do

View File

@ -13,9 +13,7 @@ describe 'openstack-dashboard::horizon' do
include_context 'redhat_stubs' include_context 'redhat_stubs'
it 'installs packages' do it 'installs packages' do
expect(chef_run).to upgrade_package('openstack-dashboard') expect(chef_run).to upgrade_package %w(openstack-dashboard mod_wsgi MySQL-python)
expect(chef_run).to upgrade_package('mod_wsgi')
expect(chef_run).to upgrade_package('MySQL-python')
end end
describe 'local_settings' do describe 'local_settings' do
@ -25,7 +23,7 @@ describe 'openstack-dashboard::horizon' do
expect(chef_run).to create_template(file.name).with( expect(chef_run).to create_template(file.name).with(
user: 'root', user: 'root',
group: 'apache', group: 'apache',
mode: 0o640 mode: '640'
) )
end end

View File

@ -58,11 +58,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('node-less') 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('libapache2-mod-wsgi-py3')
expect(chef_run).to upgrade_package('python3-django-horizon')
expect(chef_run).to upgrade_package('openstack-dashboard')
expect(chef_run).to upgrade_package('python3-mysqldb')
end end
describe 'local_settings.py' do describe 'local_settings.py' do
@ -73,7 +69,7 @@ describe 'openstack-dashboard::horizon' do
sensitive: true, sensitive: true,
user: 'root', user: 'root',
group: 'horizon', group: 'horizon',
mode: 0o640 mode: '640'
) )
end end
@ -444,7 +440,7 @@ describe 'openstack-dashboard::horizon' do
context "#{service_type} database settings" do context "#{service_type} database settings" do
cached(:chef_run) do cached(:chef_run) do
node.override['openstack']['db']['dashboard']['username'] = "#{service_type}_user" node.override['openstack']['db']['dashboard']['username'] = "#{service_type}_user"
node.override['openstack']['db']['python_packages'][service_type] = ['pkg1', 'pkg2'] node.override['openstack']['db']['python_packages'][service_type] = %w(pkg1 pkg2)
runner.converge('openstack-identity::server-apache', described_recipe) runner.converge('openstack-identity::server-apache', described_recipe)
end end
before do before do
@ -553,7 +549,7 @@ describe 'openstack-dashboard::horizon' do
.with( .with(
owner: 'root', owner: 'root',
group: 'horizon', group: 'horizon',
mode: 0o2770 mode: '2770'
) )
end end
end end

View File

@ -1,23 +0,0 @@
# encoding: UTF-8
require_relative 'spec_helper'
describe 'openstack-dashboard::neutron-fwaas-dashboard' do
describe 'ubuntu' do
cached(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
cached(:node) { runner.node }
cached(:chef_run) do
runner.converge('openstack-identity::server-apache', 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_package('python3-neutron-fwaas-dashboard')
end
end
end

View File

@ -225,7 +225,6 @@ OPENSTACK_NEUTRON_NETWORK = {
'enable_lb': <%= node['openstack']['dashboard']['neutron']['enable_lb'].to_s.capitalize %>, 'enable_lb': <%= node['openstack']['dashboard']['neutron']['enable_lb'].to_s.capitalize %>,
'enable_vpn': <%= node['openstack']['dashboard']['neutron']['enable_vpn'].to_s.capitalize %>, 'enable_vpn': <%= node['openstack']['dashboard']['neutron']['enable_vpn'].to_s.capitalize %>,
'enable_quotas': <%= node['openstack']['dashboard']['neutron']['enable_quotas'] ? 'True' : 'False' %>, 'enable_quotas': <%= node['openstack']['dashboard']['neutron']['enable_quotas'] ? 'True' : 'False' %>,
'enable_firewall': <%= node['openstack']['dashboard']['neutron']['enable_fwaas'].to_s.capitalize %>,
# The profile_support option is used to detect if an external router can be # The profile_support option is used to detect if an external router can be
# configured via the dashboard. When using specific plugins the # configured via the dashboard. When using specific plugins the
# profile_support can be turned on if needed. # profile_support can be turned on if needed.