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`
|
# This configuration was generated by `rubocop --auto-gen-config`
|
||||||
# on 2015-02-27 13:42:53 -0600 using RuboCop version 0.29.1.
|
# 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
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the offenses are removed from the code base.
|
# one by one as the offenses are removed from the code base.
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
# versions of RuboCop, may require this file to be generated again.
|
# 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
|
# Offense count: 2
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||||
Style/ClassAndModuleChildren:
|
Style/ClassAndModuleChildren:
|
||||||
Enabled: false
|
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
|
# Offense count: 1
|
||||||
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
|
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
|
||||||
Style/Next:
|
Style/Next:
|
||||||
Enabled: false
|
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
|
|
||||||
|
@ -113,7 +113,7 @@ when 'rhel'
|
|||||||
'memcache_python_packages' => ['python-memcached'],
|
'memcache_python_packages' => ['python-memcached'],
|
||||||
'package_overrides' => ''
|
'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'
|
when 'suse'
|
||||||
default['openstack']['dashboard']['horizon_user'] = 'wwwrun'
|
default['openstack']['dashboard']['horizon_user'] = 'wwwrun'
|
||||||
default['openstack']['dashboard']['horizon_group'] = 'www'
|
default['openstack']['dashboard']['horizon_group'] = 'www'
|
||||||
@ -129,7 +129,7 @@ when 'suse'
|
|||||||
'memcache_python_packages' => ['python-python-memcached'],
|
'memcache_python_packages' => ['python-python-memcached'],
|
||||||
'package_overrides' => ''
|
'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'
|
when 'debian'
|
||||||
default['openstack']['dashboard']['horizon_user'] = 'horizon'
|
default['openstack']['dashboard']['horizon_user'] = 'horizon'
|
||||||
default['openstack']['dashboard']['horizon_group'] = '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'"
|
'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']['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
|
end
|
||||||
|
|
||||||
default['openstack']['dashboard']['dash_path'] = "#{node['openstack']['dashboard']['django_path']}/openstack_dashboard"
|
default['openstack']['dashboard']['dash_path'] = "#{node['openstack']['dashboard']['django_path']}/openstack_dashboard"
|
||||||
|
@ -10,7 +10,7 @@ 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::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::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
|
supports os
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ end
|
|||||||
|
|
||||||
# delete the openstack-dashboard.conf before reload apache2 service on redhat and centos
|
# 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.
|
# 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
|
action :delete
|
||||||
backup false
|
backup false
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ file node['openstack']['dashboard']['secret_key_path'] do
|
|||||||
# set, otherwise let apache create it when someone first accesses the
|
# set, otherwise let apache create it when someone first accesses the
|
||||||
# dashboard
|
# dashboard
|
||||||
if node['openstack']['dashboard']['secret_key_content'].nil?
|
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
|
else
|
||||||
content node['openstack']['dashboard']['secret_key_content']
|
content node['openstack']['dashboard']['secret_key_content']
|
||||||
notifies :restart, 'service[apache2]'
|
notifies :restart, 'service[apache2]'
|
||||||
@ -156,7 +156,7 @@ file node['openstack']['dashboard']['secret_key_path'] do
|
|||||||
end
|
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
|
action :create
|
||||||
end
|
end
|
||||||
@ -168,8 +168,8 @@ template node['openstack']['dashboard']['apache']['sites-path'] do
|
|||||||
mode 00644
|
mode 00644
|
||||||
|
|
||||||
variables(
|
variables(
|
||||||
ssl_cert_file: "#{node["openstack"]["dashboard"]["ssl"]["dir"]}/certs/#{node["openstack"]["dashboard"]["ssl"]["cert"]}",
|
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_key_file: "#{node['openstack']['dashboard']['ssl']['dir']}/private/#{node['openstack']['dashboard']['ssl']['key']}",
|
||||||
http_bind_address: http_bind.host,
|
http_bind_address: http_bind.host,
|
||||||
http_bind_port: http_bind.port.to_i,
|
http_bind_port: http_bind.port.to_i,
|
||||||
https_bind_address: https_bind.host,
|
https_bind_address: https_bind.host,
|
||||||
@ -183,11 +183,12 @@ end
|
|||||||
# The `apache_site` provided by the apache2 cookbook
|
# The `apache_site` provided by the apache2 cookbook
|
||||||
# is not an LWRP. Guards do not apply to definitions.
|
# is not an LWRP. Guards do not apply to definitions.
|
||||||
# http://tickets.opscode.com/browse/CHEF-778
|
# http://tickets.opscode.com/browse/CHEF-778
|
||||||
if platform_family?('debian')
|
case node['platform_family']
|
||||||
|
when 'debian'
|
||||||
apache_site '000-default' do
|
apache_site '000-default' do
|
||||||
enable false
|
enable false
|
||||||
end
|
end
|
||||||
elsif platform_family?('rhel') then
|
when 'rhel'
|
||||||
apache_site 'default' do
|
apache_site 'default' do
|
||||||
enable false
|
enable false
|
||||||
|
|
||||||
|
@ -80,9 +80,9 @@ execute 'openstack-dashboard syncdb' do
|
|||||||
command 'python manage.py syncdb --noinput'
|
command 'python manage.py syncdb --noinput'
|
||||||
action :run
|
action :run
|
||||||
only_if do
|
only_if do
|
||||||
node['openstack']['dashboard']['session_backend'] == 'sql' &&
|
(node['openstack']['dashboard']['session_backend'] == 'sql' &&
|
||||||
node['openstack']['db']['dashboard']['migrate'] ||
|
node['openstack']['db']['dashboard']['migrate'] ||
|
||||||
db_info['service_type'] == 'sqlite'
|
db_info['service_type'] == 'sqlite')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
require_relative 'spec_helper'
|
require_relative 'spec_helper'
|
||||||
|
|
||||||
describe 'openstack-dashboard::apache2-server' do
|
describe 'openstack-dashboard::apache2-server' do
|
||||||
|
|
||||||
describe 'redhat' do
|
describe 'redhat' do
|
||||||
|
|
||||||
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
|
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
|
||||||
let(:node) { runner.node }
|
let(:node) { runner.node }
|
||||||
let(:chef_run) do
|
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(:crt) { chef_run.cookbook_file('/etc/pki/tls/certs/horizon.pem') }
|
||||||
let(:key) { chef_run.cookbook_file('/etc/pki/tls/private/horizon.key') }
|
let(:key) { chef_run.cookbook_file('/etc/pki/tls/private/horizon.key') }
|
||||||
|
|
||||||
it 'has proper owner' do
|
it 'creates horizon.pem' do
|
||||||
[crt, key].each do |file|
|
expect(chef_run).to create_cookbook_file(crt.name).with(
|
||||||
expect(file.owner).to eq('root')
|
user: 'root',
|
||||||
expect(file.group).to eq('root')
|
group: 'root',
|
||||||
end
|
mode: 0644
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'has proper modes' do
|
it 'creates horizon.key' do
|
||||||
expect(sprintf('%o', crt.mode)).to eq('644')
|
expect(chef_run).to create_cookbook_file(key.name).with(
|
||||||
expect(sprintf('%o', key.mode)).to eq('640')
|
user: 'root',
|
||||||
|
group: 'root',
|
||||||
|
mode: 0640
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'notifies restore-selinux-context' do
|
it 'notifies restore-selinux-context' do
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
require_relative 'spec_helper'
|
require_relative 'spec_helper'
|
||||||
|
|
||||||
describe 'openstack-dashboard::apache2-server' do
|
describe 'openstack-dashboard::apache2-server' do
|
||||||
|
|
||||||
describe 'suse' do
|
describe 'suse' do
|
||||||
|
|
||||||
let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
|
let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
|
||||||
let(:node) { runner.node }
|
let(:node) { runner.node }
|
||||||
let(:chef_run) do
|
let(:chef_run) do
|
||||||
|
@ -34,9 +34,7 @@ shared_examples 'virtualhost port configurator' do |port_attribute_name, port_at
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe 'openstack-dashboard::apache2-server' do
|
describe 'openstack-dashboard::apache2-server' do
|
||||||
|
|
||||||
describe 'ubuntu' do
|
describe 'ubuntu' do
|
||||||
|
|
||||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||||
let(:node) { runner.node }
|
let(:node) { runner.node }
|
||||||
let(:chef_run) do
|
let(:chef_run) do
|
||||||
@ -86,8 +84,8 @@ describe 'openstack-dashboard::apache2-server' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'has proper modes' do
|
it 'has proper modes' do
|
||||||
expect(sprintf('%o', crt.mode)).to eq('644')
|
expect(crt.mode).to eq(0644)
|
||||||
expect(sprintf('%o', key.mode)).to eq('640')
|
expect(key.mode).to eq(0640)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'has proper sensitvity' do
|
it 'has proper sensitvity' do
|
||||||
@ -139,13 +137,12 @@ describe 'openstack-dashboard::apache2-server' do
|
|||||||
describe 'openstack-dashboard virtual host' do
|
describe 'openstack-dashboard virtual host' do
|
||||||
let(:file) { chef_run.template('/etc/apache2/sites-available/openstack-dashboard.conf') }
|
let(:file) { chef_run.template('/etc/apache2/sites-available/openstack-dashboard.conf') }
|
||||||
|
|
||||||
it 'has proper owner' do
|
it 'creates openstack-dashboard.conf' do
|
||||||
expect(file.owner).to eq('root')
|
expect(chef_run).to create_template(file.name).with(
|
||||||
expect(file.group).to eq('root')
|
user: 'root',
|
||||||
end
|
group: 'root',
|
||||||
|
mode: 0644
|
||||||
it 'has proper modes' do
|
)
|
||||||
expect(sprintf('%o', file.mode)).to eq('644')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'template content' do
|
context 'template content' do
|
||||||
@ -161,14 +158,14 @@ describe 'openstack-dashboard::apache2-server' do
|
|||||||
|
|
||||||
context 'cache_html' do
|
context 'cache_html' do
|
||||||
it 'prevents html page caching' 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-cache env=NO_CACHE$/)
|
||||||
expect(chef_run).to render_file(file.name).with_content(/^\s*Header merge Cache-Control no-store env=NO_CACHE$/)
|
expect(chef_run).to render_file(file.name).with_content(/^\s*Header merge Cache-Control no-store env=NO_CACHE$/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'allows html page caching' do
|
it 'allows html page caching' do
|
||||||
node.set['openstack']['dashboard']['cache_html'] = true
|
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-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$/)
|
expect(chef_run).not_to render_file(file.name).with_content(/^\s*Header merge Cache-Control no-store env=NO_CACHE$/)
|
||||||
end
|
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-http-bind']['port'] = 81
|
||||||
node.set['openstack']['endpoints']['dashboard-https-bind']['port'] = https_port_value
|
node.set['openstack']['endpoints']['dashboard-https-bind']['port'] = https_port_value
|
||||||
expect(chef_run).to render_file(file.name)
|
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 the parameterized SSL rewrite rule when https_port is different from 443' do
|
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-http-bind']['port'] = 80
|
||||||
node.set['openstack']['endpoints']['dashboard-https-bind']['port'] = https_port_value
|
node.set['openstack']['endpoints']['dashboard-https-bind']['port'] = https_port_value
|
||||||
expect(chef_run).to render_file(file.name)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'shows ssl certificate related directives defaults' do
|
it 'shows ssl certificate related directives defaults' do
|
||||||
[/^\s*SSLEngine on$/,
|
[/^\s*SSLEngine on$/,
|
||||||
%r(^\s*SSLCertificateFile /etc/ssl/certs/horizon.pem$),
|
%r{^\s*SSLCertificateFile /etc/ssl/certs/horizon.pem$},
|
||||||
%r(^\s*SSLCertificateKeyFile /etc/ssl/private/horizon.key$),
|
%r{^\s*SSLCertificateKeyFile /etc/ssl/private/horizon.key$},
|
||||||
/^\s*SSLProtocol All -SSLv2 -SSLv3$/].each do |ssl_certificate_directive|
|
/^\s*SSLProtocol All -SSLv2 -SSLv3$/].each do |ssl_certificate_directive|
|
||||||
expect(chef_run).to render_file(file.name).with_content(ssl_certificate_directive)
|
expect(chef_run).to render_file(file.name).with_content(ssl_certificate_directive)
|
||||||
end
|
end
|
||||||
@ -230,8 +227,8 @@ describe 'openstack-dashboard::apache2-server' do
|
|||||||
node.set['openstack']['dashboard']['ssl']['ciphers'] = 'ssl_ciphers_value'
|
node.set['openstack']['dashboard']['ssl']['ciphers'] = 'ssl_ciphers_value'
|
||||||
|
|
||||||
[/^\s*SSLEngine on$/,
|
[/^\s*SSLEngine on$/,
|
||||||
%r(^\s*SSLCertificateFile ssl_dir_value/certs/ssl_cert_value$),
|
%r{^\s*SSLCertificateFile ssl_dir_value/certs/ssl_cert_value$},
|
||||||
%r(^\s*SSLCertificateKeyFile ssl_dir_value/private/ssl_key_value$),
|
%r{^\s*SSLCertificateKeyFile ssl_dir_value/private/ssl_key_value$},
|
||||||
/^\s*SSLProtocol ssl_protocol_value$/,
|
/^\s*SSLProtocol ssl_protocol_value$/,
|
||||||
/^\s*SSLCipherSuite ssl_ciphers_value$/].each do |ssl_directive|
|
/^\s*SSLCipherSuite ssl_ciphers_value$/].each do |ssl_directive|
|
||||||
expect(chef_run).to render_file(file.name).with_content(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
|
end
|
||||||
|
|
||||||
it 'sets the WSGI script alias defaults' do
|
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
|
end
|
||||||
|
|
||||||
it 'sets the WSGI script alias' do
|
it 'sets the WSGI script alias' do
|
||||||
@ -289,7 +286,7 @@ describe 'openstack-dashboard::apache2-server' do
|
|||||||
it 'has the default DocRoot' do
|
it 'has the default DocRoot' do
|
||||||
node.set['openstack']['dashboard']['dash_path'] = 'dash_path_value'
|
node.set['openstack']['dashboard']['dash_path'] = 'dash_path_value'
|
||||||
expect(chef_run).to render_file(file.name)
|
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
|
end
|
||||||
|
|
||||||
it 'has TraceEnable set' do
|
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
|
it 'sets wsgi socket prefix if wsgi_socket_prefix attribute is preset' do
|
||||||
node.set['openstack']['dashboard']['wsgi_socket_prefix'] = '/var/run/wsgi'
|
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
|
end
|
||||||
|
|
||||||
it 'omits wsgi socket prefix if wsgi_socket_prefix attribute is not preset' do
|
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
|
end
|
||||||
|
|
||||||
it 'calls apache_site to disable 000-default virtualhost' do
|
it 'calls apache_site to disable 000-default virtualhost' do
|
||||||
|
|
||||||
resource = chef_run.find_resource('execute',
|
resource = chef_run.find_resource('execute',
|
||||||
'a2dissite 000-default.conf').to_hash
|
'a2dissite 000-default.conf').to_hash
|
||||||
expect(resource).to include(
|
expect(resource).to include(
|
||||||
@ -414,7 +410,6 @@ describe 'openstack-dashboard::apache2-server' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'calls apache_site to enable openstack-dashboard virtualhost' do
|
it 'calls apache_site to enable openstack-dashboard virtualhost' do
|
||||||
|
|
||||||
resource = chef_run.find_resource('execute',
|
resource = chef_run.find_resource('execute',
|
||||||
'a2ensite openstack-dashboard.conf').to_hash
|
'a2ensite openstack-dashboard.conf').to_hash
|
||||||
expect(resource).to include(
|
expect(resource).to include(
|
||||||
@ -436,6 +431,5 @@ describe 'openstack-dashboard::apache2-server' do
|
|||||||
|
|
||||||
expect(chef_run).not_to run_execute(cmd)
|
expect(chef_run).not_to run_execute(cmd)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
require_relative 'spec_helper'
|
require_relative 'spec_helper'
|
||||||
|
|
||||||
describe 'openstack-dashboard::horizon' do
|
describe 'openstack-dashboard::horizon' do
|
||||||
|
|
||||||
describe 'redhat' do
|
describe 'redhat' do
|
||||||
|
|
||||||
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
|
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
|
||||||
let(:node) { runner.node }
|
let(:node) { runner.node }
|
||||||
let(:chef_run) do
|
let(:chef_run) do
|
||||||
@ -21,7 +19,7 @@ describe 'openstack-dashboard::horizon' do
|
|||||||
|
|
||||||
it 'installs db2 python packages if explicitly told' do
|
it 'installs db2 python packages if explicitly told' do
|
||||||
node.set['openstack']['db']['dashboard']['service_type'] = 'db2'
|
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)
|
expect(chef_run).to upgrade_package(pkg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -29,19 +27,18 @@ describe 'openstack-dashboard::horizon' do
|
|||||||
describe 'local_settings' do
|
describe 'local_settings' do
|
||||||
let(:file) { chef_run.template('/etc/openstack-dashboard/local_settings') }
|
let(:file) { chef_run.template('/etc/openstack-dashboard/local_settings') }
|
||||||
|
|
||||||
it 'has proper owner' do
|
it 'creates local_settings' do
|
||||||
expect(file.owner).to eq('root')
|
expect(chef_run).to create_template(file.name).with(
|
||||||
expect(file.group).to eq('apache')
|
user: 'root',
|
||||||
end
|
group: 'apache',
|
||||||
|
mode: 0640
|
||||||
it 'has proper modes' do
|
)
|
||||||
expect(sprintf('%o', file.mode)).to eq('640')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'has urls set' do
|
it 'has urls set' do
|
||||||
[
|
[
|
||||||
%r(^LOGIN_URL = '/auth/login/'$),
|
%r{^LOGIN_URL = '/auth/login/'$},
|
||||||
%r(^LOGOUT_URL = '/auth/logout/'$),
|
%r{^LOGOUT_URL = '/auth/logout/'$},
|
||||||
/^LOGIN_REDIRECT_URL = '\/'$/
|
/^LOGIN_REDIRECT_URL = '\/'$/
|
||||||
].each do |line|
|
].each do |line|
|
||||||
expect(chef_run).to render_file(file.name).with_content(line)
|
expect(chef_run).to render_file(file.name).with_content(line)
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
require_relative 'spec_helper'
|
require_relative 'spec_helper'
|
||||||
|
|
||||||
describe 'openstack-dashboard::horizon' do
|
describe 'openstack-dashboard::horizon' do
|
||||||
|
|
||||||
describe 'suse' do
|
describe 'suse' do
|
||||||
|
|
||||||
let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
|
let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
|
||||||
let(:node) { runner.node }
|
let(:node) { runner.node }
|
||||||
let(:chef_run) do
|
let(:chef_run) do
|
||||||
@ -15,7 +13,6 @@ describe 'openstack-dashboard::horizon' do
|
|||||||
include_context 'dashboard_stubs'
|
include_context 'dashboard_stubs'
|
||||||
|
|
||||||
context 'mysql backend' do
|
context 'mysql backend' do
|
||||||
|
|
||||||
include_context 'mysql_backend'
|
include_context 'mysql_backend'
|
||||||
|
|
||||||
it 'installs mysql packages when mysql backend is configured' do
|
it 'installs mysql packages when mysql backend is configured' do
|
||||||
@ -38,7 +35,6 @@ describe 'openstack-dashboard::horizon' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context 'postgresql backend' do
|
context 'postgresql backend' do
|
||||||
|
|
||||||
include_context 'postgresql_backend'
|
include_context 'postgresql_backend'
|
||||||
let(:file) { chef_run.template('/srv/www/openstack-dashboard/openstack_dashboard/local/local_settings.py') }
|
let(:file) { chef_run.template('/srv/www/openstack-dashboard/openstack_dashboard/local/local_settings.py') }
|
||||||
|
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
require_relative 'spec_helper'
|
require_relative 'spec_helper'
|
||||||
|
|
||||||
describe 'openstack-dashboard::horizon' do
|
describe 'openstack-dashboard::horizon' do
|
||||||
|
|
||||||
describe 'ubuntu' do
|
describe 'ubuntu' do
|
||||||
|
|
||||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||||
let(:node) { runner.node }
|
let(:node) { runner.node }
|
||||||
let(:chef_run) do
|
let(:chef_run) do
|
||||||
@ -28,23 +26,19 @@ describe 'openstack-dashboard::horizon' do
|
|||||||
describe 'local_settings.py' do
|
describe 'local_settings.py' do
|
||||||
let(:file) { chef_run.template('/etc/openstack-dashboard/local_settings.py') }
|
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
|
it 'notifies web service to restart delayed' do
|
||||||
expect(file).to notify('service[apache2]').to(:restart).delayed
|
expect(file).to notify('service[apache2]').to(:restart).delayed
|
||||||
end
|
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
|
context 'template contents' do
|
||||||
it 'has the customer banner' do
|
it 'has the customer banner' do
|
||||||
node.set['openstack']['dashboard']['custom_template_banner'] = 'custom_template_banner_value'
|
node.set['openstack']['dashboard']['custom_template_banner'] = 'custom_template_banner_value'
|
||||||
@ -375,11 +369,11 @@ describe 'openstack-dashboard::horizon' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'has a keystone url' do
|
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
|
end
|
||||||
|
|
||||||
it 'has a keystone admin url' do
|
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
|
end
|
||||||
|
|
||||||
it 'has a keystone default role' do
|
it 'has a keystone default role' do
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
require_relative 'spec_helper'
|
require_relative 'spec_helper'
|
||||||
|
|
||||||
describe 'openstack-dashboard::server' do
|
describe 'openstack-dashboard::server' do
|
||||||
|
|
||||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||||
let(:node) { runner.node }
|
let(:node) { runner.node }
|
||||||
let(:chef_run) do
|
let(:chef_run) do
|
||||||
@ -19,5 +18,4 @@ describe 'openstack-dashboard::server' do
|
|||||||
it 'by default installs the apache2 webserver' do
|
it 'by default installs the apache2 webserver' do
|
||||||
expect(chef_run).to include_recipe('openstack-dashboard::apache2-server')
|
expect(chef_run).to include_recipe('openstack-dashboard::apache2-server')
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user