Update resource references for dependencies

The latest version of puppet now reports these as catalog failures so
this change removes the unnecessary references and the references
should be updated.

Change-Id: I2001f8bb91ff70cf100140c7861606db459c2ad9
Closes-Bug: #1702964
Co-Authored-By: Alex Schultz <aschultz@redhat.com>
This commit is contained in:
ZhongShengping 2017-07-14 15:47:52 +08:00 committed by Alex Schultz
parent 759f10331a
commit 8686642562
18 changed files with 82 additions and 38 deletions

View File

@ -83,7 +83,7 @@ class swift(
}
user {'swift':
ensure => present,
require => Package['swift'],
require => Anchor['swift::install::end'],
}
file { '/var/lib/swift':
ensure => directory,

View File

@ -45,8 +45,11 @@ class swift::keystone::dispersion(
}
keystone_user_role { "${auth_user}@${tenant}":
ensure => present,
roles => 'admin',
require => Keystone_user[$auth_user],
ensure => present,
roles => 'admin',
}
Keystone_user<| title == $auth_user |>
~> Keystone_user_role<| title == "${auth_user}@${tenant}" |>
}

View File

@ -25,10 +25,11 @@ class swift::proxy::swauth(
package { 'python-swauth':
ensure => $package_ensure,
before => Package['swift-proxy'],
tag => 'swift-package',
}
Package['python-swauth'] -> Package<| title == 'swift-proxy' |>
swift_proxy_config {
'filter:swauth/use': value => 'egg:swauth#swauth';
'filter:swauth/default_swift_cluster': value => "local#${swauth_endpoint}";

View File

@ -42,9 +42,11 @@ define swift::storage::ext4(
swift::storage::mount { $name:
device => $device,
mnt_base_dir => $mnt_base_dir,
subscribe => Exec["mkfs-${name}"],
loopback => $loopback,
fstype => 'ext4',
}
Exec<| title == "mkfs-${name}" |>
~> Swift::Storage::Mount<| title == $name |>
}

View File

@ -62,10 +62,11 @@ define swift::storage::loopback(
command => "dd if=/dev/zero of=${base_dir}/${name} bs=${byte_size} count=0 seek=${seek}",
path => ['/usr/bin/', '/bin'],
unless => "test -f ${base_dir}/${name}",
require => File[$base_dir],
before => Anchor['swift::config::end'],
}
File<| title == $base_dir |> ~> Exec<| title == "create_partition-${name}" |>
$storage_params = {
device => "${base_dir}/${name}",
mnt_base_dir => $mnt_base_dir,

View File

@ -57,14 +57,12 @@ define swift::storage::mount(
device => $device,
fstype => $fstype,
options => "${options},${fsoptions}",
require => File["${mnt_base_dir}/${name}"],
}
# double checks to make sure that things are mounted
exec { "mount_${name}":
command => "mount ${mnt_base_dir}/${name}",
path => ['/bin'],
require => Mount["${mnt_base_dir}/${name}"],
unless => "grep ${mnt_base_dir}/${name} /etc/mtab",
# TODO - this needs to be removed when I am done testing
logoutput => true,
@ -74,7 +72,6 @@ define swift::storage::mount(
exec { "fix_mount_permissions_${name}":
command => "chown -R swift:swift ${mnt_base_dir}/${name}",
path => ['/usr/sbin', '/bin'],
subscribe => Exec["mount_${name}"],
refreshonly => true,
before => Anchor['swift::config::end'],
}
@ -90,9 +87,15 @@ define swift::storage::mount(
exec { "restorecon_mount_${name}":
command => "restorecon ${mnt_base_dir}/${name}",
path => ['/usr/sbin', '/sbin'],
subscribe => Exec["mount_${name}"],
before => [Exec["fix_mount_permissions_${name}"],Anchor['swift::config::end']],
before => Anchor['swift::config::end'],
refreshonly => true,
}
File<| title == "${mnt_base_dir}/${name}" |>
~> Mount<| title == "${mnt_base_dir}/${name}" |>
~> Exec<| title == "mount_${name}" |>
~> Exec<| title == "fix_mount_permissions_${name}" |>
~> Exec<| title == "restorecon_mount_${name}" |>
}
}

View File

@ -35,8 +35,6 @@ class swift::storage::object(
) inherits ::swift::params {
include ::swift::deps
Swift_config<| |> ~> Service['swift-object-updater']
Swift_config<| |> ~> Service['swift-object-reconstructor']
swift::storage::generic { 'object':
manage_service => $manage_service,
@ -60,7 +58,7 @@ class swift::storage::object(
enabled => $enabled,
config_file_name => $config_file_name,
service_provider => $service_provider,
require => Package['swift-object'],
require => Anchor['swift::install::end'],
service_subscribe => Concat["/etc/swift/${config_file_name}"],
}
@ -70,7 +68,7 @@ class swift::storage::object(
enabled => $enabled,
config_file_name => $config_file_name,
service_provider => $service_provider,
require => Package['swift-object'],
require => Anchor['swift::install::end'],
service_subscribe => Concat["/etc/swift/${config_file_name}"],
}

View File

@ -216,8 +216,8 @@ define swift::storage::server(
concat { "/etc/swift/${config_file_path}":
owner => $owner,
group => $group,
notify => Service["swift-${type}-server", "swift-${type}-replicator", "swift-${type}-auditor"],
require => Package['swift'],
notify => Anchor['swift::config::end'],
require => Anchor['swift::install::end'],
tag => 'swift-concat',
}
@ -239,7 +239,7 @@ define swift::storage::server(
# does not specify the backends for every specified element of
# the pipeline
before => $required_middlewares,
require => Package['swift'],
require => Anchor['swift::install::end'],
}
case $type {

View File

@ -75,7 +75,6 @@ define swift::storage::xfs(
exec { "mkfs-${name}":
command => "mkfs.xfs -f -i size=${byte_size} ${target_device}",
path => ['/sbin/', '/usr/sbin/'],
require => Package['xfsprogs'],
unless => "xfs_admin -l ${target_device}",
before => Anchor['swift::config::end'],
}
@ -83,8 +82,11 @@ define swift::storage::xfs(
swift::storage::mount { $name:
device => $mount_device,
mnt_base_dir => $mnt_base_dir,
subscribe => Exec["mkfs-${name}"],
loopback => $loopback,
}
Package<| title == 'xfsprogs' |>
~> Exec<| title == "mkfs-${name}" |>
~> Swift::Storage::Mount<| title == $name |>
}

View File

@ -13,7 +13,6 @@ describe 'swift::keystone::dispersion' do
it { is_expected.to contain_keystone_user_role('dispersion@services').with(
:ensure => 'present',
:roles => 'admin',
:require => 'Keystone_user[dispersion]'
) }
end

View File

@ -21,9 +21,13 @@ describe 'swift::proxy' do
let :pre_condition do
"class { memcached: max_memory => 1}
class { swift: swift_hash_path_suffix => string }"
class { swift: swift_hash_path_suffix => string }
include ::swift::proxy::healthcheck
include ::swift::proxy::cache
include ::swift::proxy::tempauth"
end
describe 'without the proxy local network ip address being specified' do
if Puppet::Util::Package.versioncmp(Puppet.version, '4.3.0') >= 0
it_raises 'a Puppet::Error', /expects a value for parameter 'proxy_local_net_ip'/
@ -38,6 +42,7 @@ describe 'swift::proxy' do
{:proxy_local_net_ip => '127.0.0.1'}
end
it 'passes purge to swift_proxy_config resource' do
is_expected.to contain_resources('swift_proxy_config').with({
:purge => false
@ -92,12 +97,21 @@ describe 'swift::proxy' do
class { memcached: max_memory => 1}
class { swift: swift_hash_path_suffix => string }
swift_proxy_config { 'foo/bar': value => 'foo' }
include ::swift::proxy::healthcheck
include ::swift::proxy::cache
include ::swift::proxy::tempauth
"
end
it { is_expected.to contain_swift_proxy_config('foo/bar').with_value('foo').that_notifies('Anchor[swift::config::end]')}
end
describe 'when more parameters are set' do
let :pre_condition do
"class { memcached: max_memory => 1}
class { swift: swift_hash_path_suffix => string }
include ::swift::proxy::swauth"
end
let :params do
{
:proxy_local_net_ip => '10.0.0.2',
@ -183,6 +197,12 @@ describe 'swift::proxy' do
:cors_allow_origin => 'http://foo.bar:1234,https://foo.bar',
}
end
let :pre_condition do
"class { memcached: max_memory => 1}
class { swift: swift_hash_path_suffix => string }
include ::swift::proxy::swauth"
end
it { is_expected.to contain_swift_proxy_config('DEFAULT/bind_port').with_value('80')}
it { is_expected.to contain_swift_proxy_config('DEFAULT/bind_ip').with_value('10.0.0.2')}
it { is_expected.to contain_swift_proxy_config('DEFAULT/workers').with_value('3')}
@ -239,6 +259,14 @@ describe 'swift::proxy' do
let :params do
{ :proxy_local_net_ip => '127.0.0.1' }
end
let :pre_condition do
"class { memcached: max_memory => 1}
class { swift: swift_hash_path_suffix => string }
include ::swift::proxy::healthcheck
include ::swift::proxy::cache
include ::swift::proxy::tempauth"
end
[{ :enabled => true, :manage_service => true },
{ :enabled => false, :manage_service => true }].each do |param_hash|

View File

@ -3,7 +3,7 @@ require 'spec_helper'
describe 'swift::storage::account' do
let :pre_condition do
"class { 'swift': swift_hash_path_suffix => 'foo' }
class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }"
class { 'swift::storage::all': storage_local_net_ip => '10.0.0.1' }"
end
let :params do

View File

@ -10,7 +10,10 @@ describe 'swift::storage::all' do
end
let :pre_condition do
"class { 'swift': swift_hash_path_suffix => 'changeme' }"
"class { 'swift': swift_hash_path_suffix => 'changeme' }
swift::storage::filter::healthcheck { 'container': }
swift::storage::filter::healthcheck { 'object': }
swift::storage::filter::healthcheck { 'account': }"
end
let :default_params do
@ -41,9 +44,9 @@ describe 'swift::storage::all' do
:object_port => '7000',
:container_port => '7001',
:account_port => '7002',
:object_pipeline => ["1", "2"],
:container_pipeline => ["3", "4"],
:account_pipeline => ["5", "6"],
:object_pipeline => ["healthcheck"],
:container_pipeline => ["healthcheck"],
:account_pipeline => ["healthcheck"],
:allow_versions => true,
:log_facility => ['LOG_LOCAL2', 'LOG_LOCAL3'],
:incoming_chmod => '0644',

View File

@ -3,7 +3,7 @@ require 'spec_helper'
describe 'swift::storage::container' do
let :pre_condition do
"class { 'swift': swift_hash_path_suffix => 'foo' }
class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }"
class { 'swift::storage::all': storage_local_net_ip => '10.0.0.1' }"
end
let :params do

View File

@ -4,7 +4,7 @@ describe 'swift::storage::object' do
let :pre_condition do
"class { 'swift': swift_hash_path_suffix => 'foo' }
class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }"
class { 'swift::storage::all': storage_local_net_ip => '10.0.0.1' }"
end
let :params do

View File

@ -18,7 +18,6 @@ describe 'swift::storage::mount' do
:device => '/dev/sda',
:fstype => 'xfs',
:options => 'noatime,nodiratime,nobarrier,logbufs=8',
:require => 'File[/srv/node/dans_mount_point]'
)}
end

View File

@ -11,7 +11,14 @@ describe 'swift::storage::server' do
let :pre_condition do
"class { 'swift': swift_hash_path_suffix => 'foo' }
class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }"
class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }
swift::storage::filter::healthcheck { 'container': }
swift::storage::filter::recon { 'container': }
swift::storage::filter::healthcheck { 'object': }
swift::storage::filter::recon { 'object': }
swift::storage::filter::healthcheck { 'account': }
swift::storage::filter::recon { 'account': }
"
end
let :default_params do
{
@ -64,7 +71,7 @@ describe 'swift::storage::server' do
:user => 'dan',
:mount_check => true,
:workers => 7,
:pipeline => ['foo'],
:pipeline => ['healthcheck'],
}.each do |k,v|
describe "when #{k} is set" do
let :params do req_params.merge({k => v}) end
@ -72,10 +79,10 @@ describe 'swift::storage::server' do
end
end
describe "when pipeline is passed an array" do
let :params do req_params.merge({:pipeline => ['healthcheck','recon','test']}) end
let :params do req_params.merge({:pipeline => ['healthcheck','recon']}) end
it { is_expected.to contain_concat__fragment("swift-#{t}-#{title}").with(
:content => /^pipeline\s*=\s*healthcheck recon test\s*$/,
:before => ["Swift::Storage::Filter::Healthcheck[#{t}]", "Swift::Storage::Filter::Recon[#{t}]", "Swift::Storage::Filter::Test[#{t}]"]
:content => /^pipeline\s*=\s*healthcheck recon\s*$/,
:before => ["Swift::Storage::Filter::Healthcheck[#{t}]", "Swift::Storage::Filter::Recon[#{t}]",]
)}
end
describe "when pipeline is not passed an array" do

View File

@ -36,14 +36,12 @@ describe 'swift::storage::xfs' do
it { is_expected.to contain_exec("mkfs-foo").with(
:command => "mkfs.xfs -f -i size=#{param_hash[:byte_size]} #{param_hash[:device]}",
:path => ['/sbin/', '/usr/sbin/'],
:require => 'Package[xfsprogs]'
)}
it { is_expected.to contain_swift__storage__mount(title).with(
:device => param_hash[:device],
:mnt_base_dir => param_hash[:mnt_base_dir],
:loopback => param_hash[:loopback],
:subscribe => 'Exec[mkfs-foo]'
)}
end