Cleanup minor rubocop offenses
Cleaned up all the minor rubocop issues, the ones left relate to complex logic and what I think is a bug in rubocop for nested vs compact modules/class definitions. Change-Id: I17b4f23f6e7cb71e84c74996a98d04f3782be479
This commit is contained in:
parent
1758014486
commit
13cb93ff88
|
@ -1,66 +1,16 @@
|
|||
# This configuration was generated by `rubocop --auto-gen-config`
|
||||
# on 2015-02-27 13:42:53 -0600 using RuboCop version 0.29.1.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
# versions of RuboCop, may require this file to be generated again.
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
Lint/DeprecatedClassMethods:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 2
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
Style/ClassAndModuleChildren:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 19
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
Style/EmptyLinesAroundBlockBody:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
Style/FirstParameterIndentation:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 7
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
Style/FormatString:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
Style/MultilineIfThen:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 9
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
Style/MultilineOperationIndentation:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
|
||||
Style/Next:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 13
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: PreferredDelimiters.
|
||||
Style/PercentLiteralDelimiters:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 25
|
||||
# Cop supports --auto-correct.
|
||||
Style/SingleSpaceBeforeFirstArg:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 27
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
Style/StringLiteralsInInterpolation:
|
||||
Enabled: false
|
||||
# This configuration was generated by `rubocop --auto-gen-config`
|
||||
# on 2015-05-28 16:12:46 -0500 using RuboCop version 0.29.1.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
# versions of RuboCop, may require this file to be generated again.
|
||||
|
||||
# Offense count: 2
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
Style/ClassAndModuleChildren:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
|
||||
Style/Next:
|
||||
Enabled: false
|
||||
|
|
|
@ -113,7 +113,7 @@ when 'rhel'
|
|||
'memcache_python_packages' => ['python-memcached'],
|
||||
'package_overrides' => ''
|
||||
}
|
||||
default['openstack']['dashboard']['apache']['sites-path'] = "#{node["apache"]["dir"]}/sites-available/openstack-dashboard.conf"
|
||||
default['openstack']['dashboard']['apache']['sites-path'] = "#{node['apache']['dir']}/sites-available/openstack-dashboard.conf"
|
||||
when 'suse'
|
||||
default['openstack']['dashboard']['horizon_user'] = 'wwwrun'
|
||||
default['openstack']['dashboard']['horizon_group'] = 'www'
|
||||
|
@ -129,7 +129,7 @@ when 'suse'
|
|||
'memcache_python_packages' => ['python-python-memcached'],
|
||||
'package_overrides' => ''
|
||||
}
|
||||
default['openstack']['dashboard']['apache']['sites-path'] = "#{node["apache"]["dir"]}/conf.d/openstack-dashboard.conf"
|
||||
default['openstack']['dashboard']['apache']['sites-path'] = "#{node['apache']['dir']}/conf.d/openstack-dashboard.conf"
|
||||
when 'debian'
|
||||
default['openstack']['dashboard']['horizon_user'] = 'horizon'
|
||||
default['openstack']['dashboard']['horizon_group'] = 'horizon'
|
||||
|
@ -145,7 +145,7 @@ when 'debian'
|
|||
'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'"
|
||||
}
|
||||
default['openstack']['dashboard']['platform']['horizon_packages'] = ['node-less', 'openstack-dashboard']
|
||||
default['openstack']['dashboard']['apache']['sites-path'] = "#{node["apache"]["dir"]}/sites-available/openstack-dashboard.conf"
|
||||
default['openstack']['dashboard']['apache']['sites-path'] = "#{node['apache']['dir']}/sites-available/openstack-dashboard.conf"
|
||||
end
|
||||
|
||||
default['openstack']['dashboard']['dash_path'] = "#{node['openstack']['dashboard']['django_path']}/openstack_dashboard"
|
||||
|
|
22
metadata.rb
22
metadata.rb
|
@ -1,18 +1,18 @@
|
|||
name 'openstack-dashboard'
|
||||
maintainer 'openstack-chef'
|
||||
name 'openstack-dashboard'
|
||||
maintainer 'openstack-chef'
|
||||
maintainer_email 'opscode-chef-openstack@googlegroups.com'
|
||||
license 'Apache 2.0'
|
||||
description 'Installs/Configures the OpenStack Dashboard (Horizon)'
|
||||
license 'Apache 2.0'
|
||||
description 'Installs/Configures the OpenStack Dashboard (Horizon)'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '11.0.0'
|
||||
version '11.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.'
|
||||
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 fedora redhat centos suse).each do |os|
|
||||
supports os
|
||||
end
|
||||
|
||||
depends 'apache2', '~> 3.0.0'
|
||||
depends 'openstack-common', '>= 11.1.0'
|
||||
depends 'apache2', '~> 3.0.0'
|
||||
depends 'openstack-common', '>= 11.1.0'
|
||||
|
|
|
@ -71,7 +71,7 @@ end
|
|||
|
||||
# delete the openstack-dashboard.conf before reload apache2 service on redhat and centos
|
||||
# since this file is not valid on those platforms for the apache2 service.
|
||||
file "#{node["apache"]["dir"]}/conf.d/openstack-dashboard.conf" do
|
||||
file "#{node['apache']['dir']}/conf.d/openstack-dashboard.conf" do
|
||||
action :delete
|
||||
backup false
|
||||
|
||||
|
@ -88,8 +88,8 @@ if node['openstack']['dashboard']['use_ssl']
|
|||
sensitive true
|
||||
source node['openstack']['dashboard']['ssl']['cert_url']
|
||||
mode cert_mode
|
||||
owner cert_owner
|
||||
group cert_group
|
||||
owner cert_owner
|
||||
group cert_group
|
||||
|
||||
notifies :run, 'execute[restore-selinux-context]', :immediately
|
||||
end
|
||||
|
@ -98,8 +98,8 @@ if node['openstack']['dashboard']['use_ssl']
|
|||
sensitive true
|
||||
source 'horizon.pem'
|
||||
mode cert_mode
|
||||
owner cert_owner
|
||||
group cert_group
|
||||
owner cert_owner
|
||||
group cert_group
|
||||
|
||||
notifies :run, 'execute[restore-selinux-context]', :immediately
|
||||
end
|
||||
|
@ -120,8 +120,8 @@ if node['openstack']['dashboard']['use_ssl']
|
|||
sensitive true
|
||||
source node['openstack']['dashboard']['ssl']['key_url']
|
||||
mode key_mode
|
||||
owner key_owner
|
||||
group key_group
|
||||
owner key_owner
|
||||
group key_group
|
||||
|
||||
notifies :restart, 'service[apache2]', :immediately
|
||||
notifies :run, 'execute[restore-selinux-context]', :immediately
|
||||
|
@ -130,9 +130,9 @@ if node['openstack']['dashboard']['use_ssl']
|
|||
cookbook_file key_file do
|
||||
sensitive true
|
||||
source 'horizon.key'
|
||||
mode key_mode
|
||||
owner key_owner
|
||||
group key_group
|
||||
mode key_mode
|
||||
owner key_owner
|
||||
group key_group
|
||||
|
||||
notifies :run, 'execute[restore-selinux-context]', :immediately
|
||||
end
|
||||
|
@ -148,7 +148,7 @@ file node['openstack']['dashboard']['secret_key_path'] do
|
|||
# set, otherwise let apache create it when someone first accesses the
|
||||
# dashboard
|
||||
if node['openstack']['dashboard']['secret_key_content'].nil?
|
||||
only_if { ::File.exists?(node['openstack']['dashboard']['secret_key_path']) }
|
||||
only_if { ::File.exist?(node['openstack']['dashboard']['secret_key_path']) }
|
||||
else
|
||||
content node['openstack']['dashboard']['secret_key_content']
|
||||
notifies :restart, 'service[apache2]'
|
||||
|
@ -156,20 +156,20 @@ file node['openstack']['dashboard']['secret_key_path'] do
|
|||
end
|
||||
|
||||
# stop apache bitching
|
||||
directory "#{node["openstack"]["dashboard"]["dash_path"]}/.blackhole" do
|
||||
directory "#{node['openstack']['dashboard']['dash_path']}/.blackhole" do
|
||||
owner 'root'
|
||||
action :create
|
||||
end
|
||||
|
||||
template node['openstack']['dashboard']['apache']['sites-path'] do
|
||||
source 'dash-site.erb'
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode 00644
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode 00644
|
||||
|
||||
variables(
|
||||
ssl_cert_file: "#{node["openstack"]["dashboard"]["ssl"]["dir"]}/certs/#{node["openstack"]["dashboard"]["ssl"]["cert"]}",
|
||||
ssl_key_file: "#{node["openstack"]["dashboard"]["ssl"]["dir"]}/private/#{node["openstack"]["dashboard"]["ssl"]["key"]}",
|
||||
ssl_cert_file: "#{node['openstack']['dashboard']['ssl']['dir']}/certs/#{node['openstack']['dashboard']['ssl']['cert']}",
|
||||
ssl_key_file: "#{node['openstack']['dashboard']['ssl']['dir']}/private/#{node['openstack']['dashboard']['ssl']['key']}",
|
||||
http_bind_address: http_bind.host,
|
||||
http_bind_port: http_bind.port.to_i,
|
||||
https_bind_address: https_bind.host,
|
||||
|
@ -183,11 +183,12 @@ end
|
|||
# The `apache_site` provided by the apache2 cookbook
|
||||
# is not an LWRP. Guards do not apply to definitions.
|
||||
# http://tickets.opscode.com/browse/CHEF-778
|
||||
if platform_family?('debian')
|
||||
case node['platform_family']
|
||||
when 'debian'
|
||||
apache_site '000-default' do
|
||||
enable false
|
||||
end
|
||||
elsif platform_family?('rhel') then
|
||||
when 'rhel'
|
||||
apache_site 'default' do
|
||||
enable false
|
||||
|
||||
|
|
|
@ -58,9 +58,9 @@ memcached = memcached_servers
|
|||
|
||||
template node['openstack']['dashboard']['local_settings_path'] do
|
||||
source 'local_settings.py.erb'
|
||||
owner 'root'
|
||||
group node['openstack']['dashboard']['horizon_group']
|
||||
mode 00640
|
||||
owner 'root'
|
||||
group node['openstack']['dashboard']['horizon_group']
|
||||
mode 00640
|
||||
sensitive true
|
||||
|
||||
variables(
|
||||
|
@ -80,9 +80,9 @@ execute 'openstack-dashboard syncdb' do
|
|||
command 'python manage.py syncdb --noinput'
|
||||
action :run
|
||||
only_if do
|
||||
node['openstack']['dashboard']['session_backend'] == 'sql' &&
|
||||
node['openstack']['db']['dashboard']['migrate'] ||
|
||||
db_info['service_type'] == 'sqlite'
|
||||
(node['openstack']['dashboard']['session_backend'] == 'sql' &&
|
||||
node['openstack']['db']['dashboard']['migrate'] ||
|
||||
db_info['service_type'] == 'sqlite')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-dashboard::apache2-server' do
|
||||
|
||||
describe 'redhat' do
|
||||
|
||||
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) do
|
||||
|
@ -30,16 +28,20 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
let(:crt) { chef_run.cookbook_file('/etc/pki/tls/certs/horizon.pem') }
|
||||
let(:key) { chef_run.cookbook_file('/etc/pki/tls/private/horizon.key') }
|
||||
|
||||
it 'has proper owner' do
|
||||
[crt, key].each do |file|
|
||||
expect(file.owner).to eq('root')
|
||||
expect(file.group).to eq('root')
|
||||
end
|
||||
it 'creates horizon.pem' do
|
||||
expect(chef_run).to create_cookbook_file(crt.name).with(
|
||||
user: 'root',
|
||||
group: 'root',
|
||||
mode: 0644
|
||||
)
|
||||
end
|
||||
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', crt.mode)).to eq('644')
|
||||
expect(sprintf('%o', key.mode)).to eq('640')
|
||||
it 'creates horizon.key' do
|
||||
expect(chef_run).to create_cookbook_file(key.name).with(
|
||||
user: 'root',
|
||||
group: 'root',
|
||||
mode: 0640
|
||||
)
|
||||
end
|
||||
|
||||
it 'notifies restore-selinux-context' do
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
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
|
||||
|
|
|
@ -34,9 +34,7 @@ shared_examples 'virtualhost port configurator' do |port_attribute_name, port_at
|
|||
end
|
||||
|
||||
describe 'openstack-dashboard::apache2-server' do
|
||||
|
||||
describe 'ubuntu' do
|
||||
|
||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) do
|
||||
|
@ -86,8 +84,8 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
end
|
||||
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', crt.mode)).to eq('644')
|
||||
expect(sprintf('%o', key.mode)).to eq('640')
|
||||
expect(crt.mode).to eq(0644)
|
||||
expect(key.mode).to eq(0640)
|
||||
end
|
||||
|
||||
it 'has proper sensitvity' do
|
||||
|
@ -139,13 +137,12 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
describe 'openstack-dashboard virtual host' do
|
||||
let(:file) { chef_run.template('/etc/apache2/sites-available/openstack-dashboard.conf') }
|
||||
|
||||
it 'has proper owner' do
|
||||
expect(file.owner).to eq('root')
|
||||
expect(file.group).to eq('root')
|
||||
end
|
||||
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', file.mode)).to eq('644')
|
||||
it 'creates openstack-dashboard.conf' do
|
||||
expect(chef_run).to create_template(file.name).with(
|
||||
user: 'root',
|
||||
group: 'root',
|
||||
mode: 0644
|
||||
)
|
||||
end
|
||||
|
||||
context 'template content' do
|
||||
|
@ -161,14 +158,14 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
|
||||
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$))
|
||||
expect(chef_run).to render_file(file.name).with_content(%r{^\s*SetEnvIfExpr "req\('accept'\) =~/html/" NO_CACHE$})
|
||||
expect(chef_run).to render_file(file.name).with_content(/^\s*Header merge Cache-Control no-cache env=NO_CACHE$/)
|
||||
expect(chef_run).to render_file(file.name).with_content(/^\s*Header merge Cache-Control no-store env=NO_CACHE$/)
|
||||
end
|
||||
|
||||
it 'allows html page caching' do
|
||||
node.set['openstack']['dashboard']['cache_html'] = true
|
||||
expect(chef_run).not_to render_file(file.name).with_content(%r(^\s*SetEnvIfExpr "req\('accept'\) =~/html/" NO_CACHE$))
|
||||
expect(chef_run).not_to render_file(file.name).with_content(%r{^\s*SetEnvIfExpr "req\('accept'\) =~/html/" NO_CACHE$})
|
||||
expect(chef_run).not_to render_file(file.name).with_content(/^\s*Header merge Cache-Control no-cache env=NO_CACHE$/)
|
||||
expect(chef_run).not_to render_file(file.name).with_content(/^\s*Header merge Cache-Control no-store env=NO_CACHE$/)
|
||||
end
|
||||
|
@ -197,7 +194,7 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
node.set['openstack']['endpoints']['dashboard-http-bind']['port'] = 81
|
||||
node.set['openstack']['endpoints']['dashboard-https-bind']['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\]$))
|
||||
.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
|
||||
|
@ -205,14 +202,14 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
node.set['openstack']['endpoints']['dashboard-http-bind']['port'] = 80
|
||||
node.set['openstack']['endpoints']['dashboard-https-bind']['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\]$))
|
||||
.with_content(%r{^\s*RewriteRule \^\(\.\*\)\$ https://%\{SERVER_NAME\}:#{https_port_value}%\{REQUEST_URI\} \[L,R\]$})
|
||||
end
|
||||
end
|
||||
|
||||
it 'shows ssl certificate related directives defaults' do
|
||||
[/^\s*SSLEngine on$/,
|
||||
%r(^\s*SSLCertificateFile /etc/ssl/certs/horizon.pem$),
|
||||
%r(^\s*SSLCertificateKeyFile /etc/ssl/private/horizon.key$),
|
||||
%r{^\s*SSLCertificateFile /etc/ssl/certs/horizon.pem$},
|
||||
%r{^\s*SSLCertificateKeyFile /etc/ssl/private/horizon.key$},
|
||||
/^\s*SSLProtocol All -SSLv2 -SSLv3$/].each do |ssl_certificate_directive|
|
||||
expect(chef_run).to render_file(file.name).with_content(ssl_certificate_directive)
|
||||
end
|
||||
|
@ -230,8 +227,8 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
node.set['openstack']['dashboard']['ssl']['ciphers'] = 'ssl_ciphers_value'
|
||||
|
||||
[/^\s*SSLEngine on$/,
|
||||
%r(^\s*SSLCertificateFile ssl_dir_value/certs/ssl_cert_value$),
|
||||
%r(^\s*SSLCertificateKeyFile ssl_dir_value/private/ssl_key_value$),
|
||||
%r{^\s*SSLCertificateFile ssl_dir_value/certs/ssl_cert_value$},
|
||||
%r{^\s*SSLCertificateKeyFile ssl_dir_value/private/ssl_key_value$},
|
||||
/^\s*SSLProtocol ssl_protocol_value$/,
|
||||
/^\s*SSLCipherSuite ssl_ciphers_value$/].each do |ssl_directive|
|
||||
expect(chef_run).to render_file(file.name).with_content(ssl_directive)
|
||||
|
@ -269,7 +266,7 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
end
|
||||
|
||||
it 'sets the WSGI script alias defaults' do
|
||||
expect(chef_run).to render_file(file.name).with_content(%r(^\s*WSGIScriptAlias / /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi$))
|
||||
expect(chef_run).to render_file(file.name).with_content(%r{^\s*WSGIScriptAlias / /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi$})
|
||||
end
|
||||
|
||||
it 'sets the WSGI script alias' do
|
||||
|
@ -283,13 +280,13 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
node.set['openstack']['dashboard']['horizon_group'] = 'horizon_group_value'
|
||||
node.set['openstack']['dashboard']['dash_path'] = 'dash_path_value'
|
||||
expect(chef_run).to render_file(file.name).with_content(
|
||||
/^\s*WSGIDaemonProcess dashboard user=horizon_user_value group=horizon_group_value processes=3 threads=10 python-path=dash_path_value$/)
|
||||
/^\s*WSGIDaemonProcess dashboard user=horizon_user_value group=horizon_group_value processes=3 threads=10 python-path=dash_path_value$/)
|
||||
end
|
||||
|
||||
it 'has the default DocRoot' do
|
||||
node.set['openstack']['dashboard']['dash_path'] = 'dash_path_value'
|
||||
expect(chef_run).to render_file(file.name)
|
||||
.with_content(%r(\s*DocumentRoot dash_path_value/.blackhole/$))
|
||||
.with_content(%r{\s*DocumentRoot dash_path_value/.blackhole/$})
|
||||
end
|
||||
|
||||
it 'has TraceEnable set' do
|
||||
|
@ -339,7 +336,7 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
|
||||
it 'sets wsgi socket prefix if wsgi_socket_prefix attribute is preset' do
|
||||
node.set['openstack']['dashboard']['wsgi_socket_prefix'] = '/var/run/wsgi'
|
||||
expect(chef_run).to render_file(file.name).with_content(%r(^WSGISocketPrefix /var/run/wsgi$))
|
||||
expect(chef_run).to render_file(file.name).with_content(%r{^WSGISocketPrefix /var/run/wsgi$})
|
||||
end
|
||||
|
||||
it 'omits wsgi socket prefix if wsgi_socket_prefix attribute is not preset' do
|
||||
|
@ -401,7 +398,6 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
end
|
||||
|
||||
it 'calls apache_site to disable 000-default virtualhost' do
|
||||
|
||||
resource = chef_run.find_resource('execute',
|
||||
'a2dissite 000-default.conf').to_hash
|
||||
expect(resource).to include(
|
||||
|
@ -414,7 +410,6 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
end
|
||||
|
||||
it 'calls apache_site to enable openstack-dashboard virtualhost' do
|
||||
|
||||
resource = chef_run.find_resource('execute',
|
||||
'a2ensite openstack-dashboard.conf').to_hash
|
||||
expect(resource).to include(
|
||||
|
@ -436,6 +431,5 @@ describe 'openstack-dashboard::apache2-server' do
|
|||
|
||||
expect(chef_run).not_to run_execute(cmd)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-dashboard::horizon' do
|
||||
|
||||
describe 'redhat' do
|
||||
|
||||
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) do
|
||||
|
@ -21,7 +19,7 @@ describe 'openstack-dashboard::horizon' do
|
|||
|
||||
it 'installs db2 python packages if explicitly told' do
|
||||
node.set['openstack']['db']['dashboard']['service_type'] = 'db2'
|
||||
%w{python-ibm-db python-ibm-db-django python-ibm-db-sa}.each do |pkg|
|
||||
%w(python-ibm-db python-ibm-db-django python-ibm-db-sa).each do |pkg|
|
||||
expect(chef_run).to upgrade_package(pkg)
|
||||
end
|
||||
end
|
||||
|
@ -29,19 +27,18 @@ describe 'openstack-dashboard::horizon' do
|
|||
describe 'local_settings' do
|
||||
let(:file) { chef_run.template('/etc/openstack-dashboard/local_settings') }
|
||||
|
||||
it 'has proper owner' do
|
||||
expect(file.owner).to eq('root')
|
||||
expect(file.group).to eq('apache')
|
||||
end
|
||||
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', file.mode)).to eq('640')
|
||||
it 'creates local_settings' do
|
||||
expect(chef_run).to create_template(file.name).with(
|
||||
user: 'root',
|
||||
group: 'apache',
|
||||
mode: 0640
|
||||
)
|
||||
end
|
||||
|
||||
it 'has urls set' do
|
||||
[
|
||||
%r(^LOGIN_URL = '/auth/login/'$),
|
||||
%r(^LOGOUT_URL = '/auth/logout/'$),
|
||||
%r{^LOGIN_URL = '/auth/login/'$},
|
||||
%r{^LOGOUT_URL = '/auth/logout/'$},
|
||||
/^LOGIN_REDIRECT_URL = '\/'$/
|
||||
].each do |line|
|
||||
expect(chef_run).to render_file(file.name).with_content(line)
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
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
|
||||
|
@ -15,7 +13,6 @@ describe 'openstack-dashboard::horizon' do
|
|||
include_context 'dashboard_stubs'
|
||||
|
||||
context 'mysql backend' do
|
||||
|
||||
include_context 'mysql_backend'
|
||||
|
||||
it 'installs mysql packages when mysql backend is configured' do
|
||||
|
@ -38,7 +35,6 @@ describe 'openstack-dashboard::horizon' do
|
|||
end
|
||||
|
||||
context 'postgresql backend' do
|
||||
|
||||
include_context 'postgresql_backend'
|
||||
let(:file) { chef_run.template('/srv/www/openstack-dashboard/openstack_dashboard/local/local_settings.py') }
|
||||
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-dashboard::horizon' do
|
||||
|
||||
describe 'ubuntu' do
|
||||
|
||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) do
|
||||
|
@ -28,23 +26,19 @@ describe 'openstack-dashboard::horizon' do
|
|||
describe 'local_settings.py' do
|
||||
let(:file) { chef_run.template('/etc/openstack-dashboard/local_settings.py') }
|
||||
|
||||
it 'creates local_settings' do
|
||||
expect(chef_run).to create_template(file.name).with(
|
||||
sensitive: true,
|
||||
user: 'root',
|
||||
group: 'horizon',
|
||||
mode: 0640
|
||||
)
|
||||
end
|
||||
|
||||
it 'notifies web service to restart delayed' do
|
||||
expect(file).to notify('service[apache2]').to(:restart).delayed
|
||||
end
|
||||
|
||||
it 'has proper owner' do
|
||||
expect(file.owner).to eq('root')
|
||||
expect(file.group).to eq('horizon')
|
||||
end
|
||||
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', file.mode)).to eq('640')
|
||||
end
|
||||
|
||||
it 'has proper sensitvity' do
|
||||
expect(file.sensitive).to eq(true)
|
||||
end
|
||||
|
||||
context 'template contents' do
|
||||
it 'has the customer banner' do
|
||||
node.set['openstack']['dashboard']['custom_template_banner'] = 'custom_template_banner_value'
|
||||
|
@ -375,11 +369,11 @@ describe 'openstack-dashboard::horizon' do
|
|||
end
|
||||
|
||||
it 'has a keystone url' do
|
||||
expect(chef_run).to render_file(file.name).with_content(%r(OPENSTACK_KEYSTONE_URL = "http://127.0.0.1:5000/v2.0"))
|
||||
expect(chef_run).to render_file(file.name).with_content(%r{OPENSTACK_KEYSTONE_URL = "http://127.0.0.1:5000/v2.0"})
|
||||
end
|
||||
|
||||
it 'has a keystone admin url' do
|
||||
expect(chef_run).to render_file(file.name).with_content(%r(OPENSTACK_KEYSTONE_ADMIN_URL = "http://127.0.0.1:35357/v2.0"))
|
||||
expect(chef_run).to render_file(file.name).with_content(%r{OPENSTACK_KEYSTONE_ADMIN_URL = "http://127.0.0.1:35357/v2.0"})
|
||||
end
|
||||
|
||||
it 'has a keystone default role' do
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-dashboard::server' do
|
||||
|
||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) do
|
||||
|
@ -19,5 +18,4 @@ describe 'openstack-dashboard::server' do
|
|||
it 'by default installs the apache2 webserver' do
|
||||
expect(chef_run).to include_recipe('openstack-dashboard::apache2-server')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -30,10 +30,10 @@ end
|
|||
shared_context 'dashboard_stubs' do
|
||||
before do
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:memcached_servers)
|
||||
.and_return ['hostA:port', 'hostB:port']
|
||||
.and_return ['hostA:port', 'hostB:port']
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||
.with('db', 'horizon')
|
||||
.and_return('test-passes')
|
||||
.with('db', 'horizon')
|
||||
.and_return('test-passes')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -57,15 +57,15 @@ end
|
|||
shared_context 'postgresql_backend' do
|
||||
before do
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:db)
|
||||
.with('dashboard')
|
||||
.and_return('service_type' => 'postgresql', 'db_name' => 'flying_elephant')
|
||||
.with('dashboard')
|
||||
.and_return('service_type' => 'postgresql', 'db_name' => 'flying_elephant')
|
||||
end
|
||||
end
|
||||
|
||||
shared_context 'mysql_backend' do
|
||||
before do
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:db)
|
||||
.with('dashboard')
|
||||
.and_return('service_type' => 'mysql', 'db_name' => 'flying_dolphin')
|
||||
.with('dashboard')
|
||||
.and_return('service_type' => 'mysql', 'db_name' => 'flying_dolphin')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue