Replace legacy facts and use fact hash
... because the latest lint no longer allows usage of legacy facts and top scope fact. Change-Id: If81712ed2129684d887668f6320e88a206fdad4b
This commit is contained in:
parent
66dc9289fc
commit
62439012bd
@ -2,7 +2,7 @@ Exec { logoutput => 'on_failure' }
|
||||
|
||||
include openstacklib::defaults
|
||||
|
||||
if $::osfamily == 'RedHat' {
|
||||
if $facts['os']['family'] == 'RedHat' {
|
||||
# Virtual package name, present in @base.
|
||||
package { 'perl(Net::HTTP)':
|
||||
ensure => present,
|
||||
|
@ -5,7 +5,7 @@ Puppet::Type.type(:policy_rcd).provide(:policy_rcd) do
|
||||
mk_resource_methods
|
||||
|
||||
def check_os
|
||||
Facter.value(:osfamily) == 'Debian'
|
||||
Facter.value(:os)['family'] == 'Debian'
|
||||
end
|
||||
|
||||
def check_policy_rcd
|
||||
|
@ -5,7 +5,7 @@
|
||||
# This file is loaded in the params.pp of each class.
|
||||
#
|
||||
class openstacklib::defaults {
|
||||
case $::osfamily {
|
||||
case $facts['os']['family'] {
|
||||
'RedHat': {
|
||||
$pyver3 = '3.9'
|
||||
}
|
||||
@ -13,7 +13,7 @@ class openstacklib::defaults {
|
||||
$pyver3 = '3'
|
||||
}
|
||||
default:{
|
||||
fail("Unsupported osfamily: ${::osfamily}")
|
||||
fail("Unsupported osfamily: ${facts['os']['family']}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ class openstacklib::params {
|
||||
|
||||
$openstackclient_package_name = 'python3-openstackclient'
|
||||
|
||||
case $::osfamily {
|
||||
case $facts['os']['family'] {
|
||||
'RedHat': {
|
||||
$open_iscsi_package_name = 'iscsi-initiator-utils'
|
||||
}
|
||||
@ -17,8 +17,7 @@ class openstacklib::params {
|
||||
$open_iscsi_package_name = 'open-iscsi'
|
||||
}
|
||||
default:{
|
||||
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, \
|
||||
module ${module_name} only support osfamily RedHat and Debian")
|
||||
fail("Unsupported osfamily: ${facts['os']['family']}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class openstacklib::policyrcd(
|
||||
|
||||
validate_legacy(Array, 'validate_array', $services)
|
||||
|
||||
if $::osfamily == 'Debian' {
|
||||
if $facts['os']['family'] == 'Debian' {
|
||||
# We put this out there so openstack services wont auto start
|
||||
# when installed.
|
||||
file { '/usr/sbin/policy-rc.d':
|
||||
|
@ -29,7 +29,7 @@
|
||||
#
|
||||
# [*servername*]
|
||||
# (Optional) The servername for the virtualhost
|
||||
# Defaults to $::fqdn
|
||||
# Defaults to $facts['networking']['fqdn']
|
||||
#
|
||||
# [*bind_host*]
|
||||
# (Optional) The host/ip address Apache will listen on.
|
||||
@ -102,7 +102,7 @@
|
||||
#
|
||||
# [*workers*]
|
||||
# (Optional) The number of workers for the vhost.
|
||||
# Defaults to $::os_workers
|
||||
# Defaults to $facts['os_workers']
|
||||
#
|
||||
# [*wsgi_daemon_process*]
|
||||
# (Optional) Name of the WSGI daemon process.
|
||||
@ -238,7 +238,7 @@
|
||||
#
|
||||
define openstacklib::wsgi::apache (
|
||||
$service_name = $name,
|
||||
$servername = $::fqdn,
|
||||
$servername = $facts['networking']['fqdn'],
|
||||
$bind_host = undef,
|
||||
$bind_port = undef,
|
||||
$group = undef,
|
||||
@ -256,7 +256,7 @@ define openstacklib::wsgi::apache (
|
||||
$ssl_verify_client = undef,
|
||||
$threads = 1,
|
||||
$user = undef,
|
||||
$workers = $::os_workers,
|
||||
$workers = $facts['os_workers'],
|
||||
$wsgi_daemon_process = $name,
|
||||
$wsgi_process_display_name = $name,
|
||||
$wsgi_process_group = $name,
|
||||
|
@ -32,7 +32,7 @@ describe 'openstacklib::iscsid' do
|
||||
end
|
||||
|
||||
let(:platform_params) do
|
||||
case facts[:osfamily]
|
||||
case facts[:os]['family']
|
||||
when 'Debian'
|
||||
{ :open_iscsi_package_name => 'open-iscsi' }
|
||||
when 'RedHat'
|
||||
|
@ -32,7 +32,7 @@ describe 'openstacklib::openstackclient' do
|
||||
end
|
||||
|
||||
let(:platform_params) do
|
||||
case facts[:osfamily]
|
||||
case facts[:os]['family']
|
||||
when 'Debian'
|
||||
{ :openstackclient_package_name => 'python3-openstackclient' }
|
||||
when 'RedHat'
|
||||
|
@ -93,7 +93,7 @@ eof
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_behaves_like "openstacklib::policyrcd on #{facts[:osfamily]} platforms"
|
||||
it_behaves_like "openstacklib::policyrcd on #{facts[:os]['family']} platforms"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -20,14 +20,6 @@ require 'spec_helper'
|
||||
describe 'openstacklib::wsgi::apache' do
|
||||
let (:title) { 'keystone_wsgi' }
|
||||
|
||||
let :global_facts do
|
||||
{
|
||||
:os_workers => 8,
|
||||
:concat_basedir => '/var/lib/puppet/concat',
|
||||
:fqdn => 'some.host.tld'
|
||||
}
|
||||
end
|
||||
|
||||
let :params do
|
||||
{
|
||||
:bind_port => 5000,
|
||||
@ -66,7 +58,7 @@ describe 'openstacklib::wsgi::apache' do
|
||||
)}
|
||||
|
||||
it { should contain_apache__vhost('keystone_wsgi').with(
|
||||
:servername => 'some.host.tld',
|
||||
:servername => 'foo.example.com',
|
||||
:ip => nil,
|
||||
:port => '5000',
|
||||
:docroot => '/var/www/cgi-bin/keystone',
|
||||
@ -79,7 +71,7 @@ describe 'openstacklib::wsgi::apache' do
|
||||
'keystone_wsgi' => {
|
||||
'user' => 'keystone',
|
||||
'group' => 'keystone',
|
||||
'processes' => global_facts[:os_workers],
|
||||
'processes' => facts[:os_workers],
|
||||
'threads' => 1,
|
||||
'display-name' => 'keystone_wsgi',
|
||||
}},
|
||||
@ -190,7 +182,7 @@ describe 'openstacklib::wsgi::apache' do
|
||||
'keystone_wsgi' => {
|
||||
'user' => 'someotheruser',
|
||||
'group' => 'someothergroup',
|
||||
'processes' => global_facts[:os_workers],
|
||||
'processes' => facts[:os_workers],
|
||||
'threads' => 1,
|
||||
'display-name' => 'keystone_wsgi',
|
||||
'python_path' => '/my/python/admin/path',
|
||||
@ -259,11 +251,13 @@ describe 'openstacklib::wsgi::apache' do
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts(global_facts))
|
||||
facts.merge!(OSDefaults.get_facts({
|
||||
:os_workers => 8,
|
||||
}))
|
||||
end
|
||||
|
||||
let(:platform_params) do
|
||||
case facts[:osfamily]
|
||||
case facts[:os]['family']
|
||||
when 'Debian'
|
||||
{
|
||||
:httpd_service_name => 'apache2',
|
||||
|
Loading…
x
Reference in New Issue
Block a user