Replace legacy facts and use fact hash
... because the latest lint no longer allows usage of legacy facts and top scope fact. Change-Id: I7a37d698eaf31fe51f656966cfcda44721648b17
This commit is contained in:
parent
6a8d57402b
commit
17f9bd3fcf
@ -42,7 +42,7 @@ define horizon::dashboard (
|
||||
The class allows more flexible customization of the ${dashboard} dashboard.")
|
||||
}
|
||||
|
||||
case $::osfamily {
|
||||
case $facts['os']['family'] {
|
||||
'Debian': {
|
||||
$dashboard_package_name = "python3-${dashboard}-dashboard"
|
||||
}
|
||||
@ -50,7 +50,7 @@ The class allows more flexible customization of the ${dashboard} dashboard.")
|
||||
$dashboard_package_name = "openstack-${dashboard}-ui"
|
||||
}
|
||||
default: {
|
||||
fail("Unsupported OS family: ${::osfamily}")
|
||||
fail("Unsupported osfamily: ${facts['os']['family']}")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,19 +10,19 @@
|
||||
#
|
||||
# [*servername*]
|
||||
# (optional) FQDN used for the Server Name directives
|
||||
# Defaults to ::fqdn.
|
||||
# Defaults to facts['networking']['fqdn'].
|
||||
#
|
||||
# [*allowed_hosts*]
|
||||
# (optional) List of hosts which will be set as value of ALLOWED_HOSTS
|
||||
# parameter in settings_local.py. This is used by Django for
|
||||
# security reasons. Can be set to * in environments where security is
|
||||
# deemed unimportant.
|
||||
# Defaults to ::fqdn.
|
||||
# Defaults to facts['networking']['fqdn'].
|
||||
#
|
||||
# [*server_aliases*]
|
||||
# (optional) List of names which should be defined as ServerAlias directives
|
||||
# in vhost.conf.
|
||||
# Defaults to ::fqdn.
|
||||
# Defaults to facts['networking']['fqdn'].
|
||||
#
|
||||
# [*package_ensure*]
|
||||
# (optional) Package ensure state. Defaults to 'present'.
|
||||
@ -280,7 +280,7 @@
|
||||
#
|
||||
# [*wsgi_processes*]
|
||||
# (optional) Number of Horizon processes to spawn
|
||||
# Defaults to $::os_workers
|
||||
# Defaults to $facts['os_workers']
|
||||
#
|
||||
# [*wsgi_threads*]
|
||||
# (optional) Number of thread to run in a Horizon process
|
||||
@ -598,9 +598,9 @@ class horizon(
|
||||
$local_settings_template = 'horizon/local_settings.py.erb',
|
||||
$configure_apache = true,
|
||||
$bind_address = undef,
|
||||
$servername = $::fqdn,
|
||||
$server_aliases = $::fqdn,
|
||||
$allowed_hosts = $::fqdn,
|
||||
$servername = $facts['networking']['fqdn'],
|
||||
$server_aliases = $facts['networking']['fqdn'],
|
||||
$allowed_hosts = $facts['networking']['fqdn'],
|
||||
$listen_ssl = false,
|
||||
$http_port = 80,
|
||||
$https_port = 443,
|
||||
@ -611,7 +611,7 @@ class horizon(
|
||||
$ssl_key = undef,
|
||||
$ssl_ca = undef,
|
||||
$ssl_verify_client = undef,
|
||||
$wsgi_processes = $::os_workers,
|
||||
$wsgi_processes = $facts['os_workers'],
|
||||
$wsgi_threads = '1',
|
||||
$compress_offline = true,
|
||||
$hypervisor_options = {},
|
||||
@ -842,7 +842,7 @@ class horizon(
|
||||
|
||||
if $compress_offline {
|
||||
Concat<| tag == 'django-config' |> ~> Exec['refresh_horizon_django_compress']
|
||||
if $::osfamily == 'RedHat' {
|
||||
if $facts['os']['family'] == 'RedHat' {
|
||||
Concat<| tag == 'django-config' |> ~> Exec['refresh_horizon_django_cache'] -> Exec['refresh_horizon_django_compress']
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ class horizon::params {
|
||||
$manage_py = '/usr/share/openstack-dashboard/manage.py'
|
||||
$wsgi_application_group = '%{GLOBAL}'
|
||||
|
||||
case $::osfamily {
|
||||
case $facts['os']['family'] {
|
||||
'RedHat': {
|
||||
$package_name = 'openstack-dashboard'
|
||||
$config_dir = '/etc/openstack-dashboard'
|
||||
@ -44,7 +44,7 @@ class horizon::params {
|
||||
$heat_dashboard_package_name = 'python3-heat-dashboard'
|
||||
$manila_dashboard_package_name = 'python3-manila-dashboard'
|
||||
$octavia_dashboard_package_name = 'python3-octavia-dashboard'
|
||||
case $::operatingsystem {
|
||||
case $facts['os']['name'] {
|
||||
'Debian': {
|
||||
$package_name = 'openstack-dashboard-apache'
|
||||
$httpd_config_file = '/etc/apache2/sites-available/openstack-dashboard-alias-only.conf'
|
||||
@ -56,8 +56,7 @@ class horizon::params {
|
||||
}
|
||||
}
|
||||
default: {
|
||||
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, \
|
||||
module ${module_name} only support osfamily RedHat and Debian")
|
||||
fail("Unsupported osfamily: ${facts['os']['family']}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#
|
||||
# [*servername*]
|
||||
# (Optional) Server Name
|
||||
# Defaults to ::fqdn.
|
||||
# Defaults to facts['networking']['fqdn'].
|
||||
#
|
||||
# [*ssl_redirect*]
|
||||
# (Optional) Enable SSL Redirect
|
||||
@ -18,7 +18,7 @@
|
||||
# [*server_aliases*]
|
||||
# (optional) List of names which should be defined as ServerAlias directives
|
||||
# in vhost.conf.
|
||||
# Defaults to ::fqdn.
|
||||
# Defaults to facts['networking']['fqdn'].
|
||||
#
|
||||
# [*listen_ssl*]
|
||||
# (optional) Enable SSL support in Apache. (Defaults to false)
|
||||
@ -45,7 +45,7 @@
|
||||
#
|
||||
# [*wsgi_processes*]
|
||||
# (optional) Number of Horizon processes to spawn
|
||||
# Defaults to $::os_workers
|
||||
# Defaults to $facts['os_workers']
|
||||
#
|
||||
# [*wsgi_threads*]
|
||||
# (optional) Number of thread to run in a Horizon process
|
||||
@ -119,8 +119,8 @@
|
||||
#
|
||||
class horizon::wsgi::apache (
|
||||
$bind_address = undef,
|
||||
$servername = $::fqdn,
|
||||
$server_aliases = $::fqdn,
|
||||
$servername = $facts['networking']['fqdn'],
|
||||
$server_aliases = $facts['networking']['fqdn'],
|
||||
$listen_ssl = false,
|
||||
$http_port = 80,
|
||||
$https_port = 443,
|
||||
@ -129,7 +129,7 @@ class horizon::wsgi::apache (
|
||||
$ssl_key = undef,
|
||||
$ssl_ca = undef,
|
||||
$ssl_verify_client = undef,
|
||||
$wsgi_processes = $::os_workers,
|
||||
$wsgi_processes = $facts['os_workers'],
|
||||
$wsgi_threads = '1',
|
||||
$custom_wsgi_process_options = {},
|
||||
$priority = 15,
|
||||
|
@ -94,7 +94,7 @@ eos
|
||||
end
|
||||
|
||||
let(:platform_params) do
|
||||
case facts[:osfamily]
|
||||
case facts[:os]['family']
|
||||
when 'Debian'
|
||||
{ :designate_dashboard_package_name => 'python3-designate-dashboard' }
|
||||
when 'RedHat'
|
||||
|
@ -148,7 +148,7 @@ eos
|
||||
end
|
||||
|
||||
let(:platform_params) do
|
||||
case facts[:osfamily]
|
||||
case facts[:os]['family']
|
||||
when 'Debian'
|
||||
{ :heat_dashboard_package_name => 'python3-heat-dashboard' }
|
||||
when 'RedHat'
|
||||
|
@ -103,7 +103,7 @@ eos
|
||||
end
|
||||
|
||||
let(:platform_params) do
|
||||
case facts[:osfamily]
|
||||
case facts[:os]['family']
|
||||
when 'Debian'
|
||||
{ :manila_dashboard_package_name => 'python3-manila-dashboard' }
|
||||
when 'RedHat'
|
||||
|
@ -94,7 +94,7 @@ eos
|
||||
end
|
||||
|
||||
let(:platform_params) do
|
||||
case facts[:osfamily]
|
||||
case facts[:os]['family']
|
||||
when 'Debian'
|
||||
{ :octavia_dashboard_package_name => 'python3-octavia-dashboard' }
|
||||
when 'RedHat'
|
||||
|
@ -32,7 +32,7 @@ describe 'horizon' do
|
||||
:refreshonly => true,
|
||||
})}
|
||||
it {
|
||||
if facts[:osfamily] == 'RedHat'
|
||||
if facts[:os]['family'] == 'RedHat'
|
||||
is_expected.to contain_concat(platforms_params[:config_file]).that_notifies('Exec[refresh_horizon_django_cache]')
|
||||
is_expected.to contain_concat(platforms_params[:config_file]).that_notifies('Exec[refresh_horizon_django_compress]')
|
||||
else
|
||||
@ -50,7 +50,7 @@ describe 'horizon' do
|
||||
|
||||
it 'configures apache' do
|
||||
is_expected.to contain_class('horizon::wsgi::apache').with({
|
||||
:servername => 'some.host.tld',
|
||||
:servername => 'foo.example.com',
|
||||
:listen_ssl => false,
|
||||
:wsgi_processes => facts[:os_workers],
|
||||
:wsgi_threads => '1',
|
||||
@ -65,7 +65,7 @@ describe 'horizon' do
|
||||
"LOGIN_URL = '#{platforms_params[:root_url]}/auth/login/'",
|
||||
"LOGOUT_URL = '#{platforms_params[:root_url]}/auth/logout/'",
|
||||
"LOGIN_REDIRECT_URL = '#{platforms_params[:root_url]}/'",
|
||||
"ALLOWED_HOSTS = ['some.host.tld', ]",
|
||||
"ALLOWED_HOSTS = ['foo.example.com', ]",
|
||||
'HORIZON_CONFIG["password_autocomplete"] = "off"',
|
||||
"SECRET_KEY = 'elj1IWiLoWHgcyYxFVLj7cM5rGOOxWl0'",
|
||||
'OPENSTACK_KEYSTONE_URL = "http://127.0.0.1:5000"',
|
||||
@ -149,7 +149,7 @@ describe 'horizon' do
|
||||
verify_concat_fragment_contents(catalogue, 'local_settings.py', [
|
||||
'DEBUG = True',
|
||||
"SITE_BRANDING = 'mysite'",
|
||||
"ALLOWED_HOSTS = ['some.host.tld', ]",
|
||||
"ALLOWED_HOSTS = ['foo.example.com', ]",
|
||||
"SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')",
|
||||
"SECURE_PROXY_ADDR_HEADER = 'HTTP_X_FORWARDED_FOR'",
|
||||
'CSRF_COOKIE_SECURE = True',
|
||||
@ -400,7 +400,7 @@ describe 'horizon' do
|
||||
before do
|
||||
params.merge!({
|
||||
:listen_ssl => true,
|
||||
:servername => 'some.host.tld',
|
||||
:servername => 'foo.example.com',
|
||||
:ssl_cert => '/etc/pki/tls/certs/httpd.crt',
|
||||
:ssl_key => '/etc/pki/tls/private/httpd.key',
|
||||
:ssl_ca => '/etc/pki/tls/certs/ca.crt',
|
||||
@ -756,17 +756,13 @@ describe 'horizon' do
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts({
|
||||
:fqdn => 'some.host.tld',
|
||||
:concat_basedir => '/var/lib/puppet/concat',
|
||||
:os_workers => '6'
|
||||
}))
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
let(:platforms_params) do
|
||||
case facts[:osfamily]
|
||||
case facts[:os]['family']
|
||||
when 'Debian'
|
||||
if facts[:operatingsystem] == 'Debian'
|
||||
if facts[:os]['name'] == 'Debian'
|
||||
{ :config_file => '/etc/openstack-dashboard/local_settings.py',
|
||||
:conf_d_dir => '/etc/openstack-dashboard/local_settings.d',
|
||||
:package_name => 'openstack-dashboard-apache',
|
||||
@ -804,7 +800,7 @@ describe 'horizon' do
|
||||
end
|
||||
|
||||
it_behaves_like 'horizon'
|
||||
it_behaves_like "horizon on #{facts[:osfamily]}"
|
||||
it_behaves_like "horizon on #{facts[:os]['family']}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,9 +2,7 @@ require 'spec_helper'
|
||||
|
||||
describe 'horizon::wsgi::apache' do
|
||||
let :params do
|
||||
{
|
||||
:servername => 'some.host.tld',
|
||||
}
|
||||
{}
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
@ -25,11 +23,11 @@ describe 'horizon::wsgi::apache' do
|
||||
it { should contain_package('horizon').with_ensure('present') }
|
||||
|
||||
it { should contain_apache__vhost('horizon_vhost').with(
|
||||
:servername => 'some.host.tld',
|
||||
:servername => 'foo.example.com',
|
||||
:access_log_file => 'horizon_access.log',
|
||||
:error_log_file => 'horizon_error.log',
|
||||
:priority => 15,
|
||||
:serveraliases => ['some.host.tld'],
|
||||
:serveraliases => ['foo.example.com'],
|
||||
:docroot => '/var/www/',
|
||||
:ssl => 'false',
|
||||
:port => '80',
|
||||
@ -67,12 +65,12 @@ describe 'horizon::wsgi::apache' do
|
||||
it { should contain_package('horizon').with_ensure('present') }
|
||||
|
||||
it { should contain_apache__vhost('horizon_vhost').with(
|
||||
:servername => 'some.host.tld',
|
||||
:servername => 'foo.example.com',
|
||||
:access_log_file => 'horizon_access.log',
|
||||
:access_log_format => 'common',
|
||||
:error_log_file => 'horizon_error.log',
|
||||
:priority => params[:priority],
|
||||
:serveraliases => ['some.host.tld'],
|
||||
:serveraliases => ['foo.example.com'],
|
||||
:docroot => '/var/www/',
|
||||
:ssl => 'false',
|
||||
:port => '80',
|
||||
@ -129,11 +127,11 @@ describe 'horizon::wsgi::apache' do
|
||||
end
|
||||
|
||||
it { should contain_apache__vhost('horizon_ssl_vhost').with(
|
||||
:servername => 'some.host.tld',
|
||||
:servername => 'foo.example.com',
|
||||
:access_log_file => 'horizon_ssl_access.log',
|
||||
:error_log_file => 'horizon_ssl_error.log',
|
||||
:priority => 15,
|
||||
:serveraliases => ['some.host.tld'],
|
||||
:serveraliases => ['foo.example.com'],
|
||||
:docroot => '/var/www/',
|
||||
:ssl => 'true',
|
||||
:port => '443',
|
||||
@ -160,17 +158,17 @@ describe 'horizon::wsgi::apache' do
|
||||
)}
|
||||
|
||||
it { should contain_apache__vhost('horizon_vhost').with(
|
||||
:servername => 'some.host.tld',
|
||||
:servername => 'foo.example.com',
|
||||
:access_log_file => 'horizon_access.log',
|
||||
:error_log_file => 'horizon_error.log',
|
||||
:priority => 15,
|
||||
:serveraliases => ['some.host.tld'],
|
||||
:serveraliases => ['foo.example.com'],
|
||||
:docroot => '/var/www/',
|
||||
:ssl => 'false',
|
||||
:port => '80',
|
||||
:redirectmatch_status => 'permanent',
|
||||
:redirectmatch_regexp => '(.*)',
|
||||
:redirectmatch_dest => 'https://some.host.tld',
|
||||
:redirectmatch_dest => 'https://foo.example.com',
|
||||
:wsgi_process_group => platforms_params[:wsgi_group],
|
||||
:wsgi_daemon_process => {
|
||||
platforms_params[:wsgi_group] => {
|
||||
@ -343,7 +341,7 @@ describe 'horizon::wsgi::apache' do
|
||||
|
||||
it { should contain_apache__vhost('horizon_vhost').with(
|
||||
:redirectmatch_regexp => '(.*)',
|
||||
:redirectmatch_dest => 'https://some.host.tld',
|
||||
:redirectmatch_dest => 'https://foo.example.com',
|
||||
)}
|
||||
|
||||
it { should contain_apache__vhost('horizon_ssl_vhost').with(
|
||||
@ -367,7 +365,7 @@ describe 'horizon::wsgi::apache' do
|
||||
|
||||
it { should contain_apache__vhost('horizon_vhost').with(
|
||||
:redirectmatch_regexp => '(.*)',
|
||||
:redirectmatch_dest => 'https://some.host.tld',
|
||||
:redirectmatch_dest => 'https://foo.example.com',
|
||||
)}
|
||||
|
||||
it { should contain_apache__vhost('horizon_ssl_vhost').with(
|
||||
@ -391,7 +389,7 @@ describe 'horizon::wsgi::apache' do
|
||||
|
||||
it { should contain_apache__vhost('horizon_vhost').with(
|
||||
:redirectmatch_regexp => '(.*)',
|
||||
:redirectmatch_dest => 'https://some.host.tld',
|
||||
:redirectmatch_dest => 'https://foo.example.com',
|
||||
)}
|
||||
|
||||
it { should contain_apache__vhost('horizon_ssl_vhost').with(
|
||||
@ -498,16 +496,14 @@ describe 'horizon::wsgi::apache' do
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts({
|
||||
:fqdn => 'some.host.tld',
|
||||
:concat_basedir => '/var/lib/puppet/concat',
|
||||
:os_workers => '6'
|
||||
:os_workers => '6'
|
||||
}))
|
||||
end
|
||||
|
||||
let(:platforms_params) do
|
||||
case facts[:osfamily]
|
||||
case facts[:os]['family']
|
||||
when 'Debian'
|
||||
case facts[:operatingsystem]
|
||||
case facts[:os]['name']
|
||||
when 'Debian'
|
||||
{ :httpd_config_file => '/etc/apache2/sites-available/openstack-dashboard-alias-only.conf',
|
||||
:root_url => '/horizon',
|
||||
@ -528,7 +524,7 @@ describe 'horizon::wsgi::apache' do
|
||||
end
|
||||
|
||||
it_behaves_like 'horizon::wsgi::apache'
|
||||
it_behaves_like "horizon::wsgi::apache on #{facts[:osfamily]}"
|
||||
it_behaves_like "horizon::wsgi::apache on #{facts[:os]['family']}"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -71,7 +71,7 @@ describe 'horizon::dashboard' do
|
||||
end
|
||||
|
||||
let(:platform_params) do
|
||||
case facts[:osfamily]
|
||||
case facts[:os]['family']
|
||||
when 'Debian'
|
||||
{ :heat_dashboard_package_name => 'python3-heat-dashboard' }
|
||||
when 'RedHat'
|
||||
@ -81,8 +81,8 @@ describe 'horizon::dashboard' do
|
||||
|
||||
it_behaves_like 'horizon::dashboard'
|
||||
|
||||
if facts[:osfamily] == 'Debian'
|
||||
it_behaves_like "horizon::dashboard on #{facts[:operatingsystem]}"
|
||||
if facts[:os]['family'] == 'Debian'
|
||||
it_behaves_like "horizon::dashboard on #{facts[:os]['name']}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -71,7 +71,7 @@ eos
|
||||
end
|
||||
|
||||
let (:platform_params) do
|
||||
case facts[:osfamily]
|
||||
case facts[:os]['family']
|
||||
when 'Debian'
|
||||
{ :wsgi_user => 'horizon',
|
||||
:wsgi_group => 'horizon' }
|
||||
|
Loading…
x
Reference in New Issue
Block a user