diff --git a/manifests/init.pp b/manifests/init.pp index 1d9b17ae..936868e9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -83,7 +83,7 @@ class swift( } user {'swift': ensure => present, - require => Package['swift'], + require => Anchor['swift::install::end'], } file { '/var/lib/swift': ensure => directory, diff --git a/manifests/keystone/dispersion.pp b/manifests/keystone/dispersion.pp index 37ec651d..f55fbc8d 100644 --- a/manifests/keystone/dispersion.pp +++ b/manifests/keystone/dispersion.pp @@ -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}" |> + } diff --git a/manifests/proxy/swauth.pp b/manifests/proxy/swauth.pp index df3e17a3..0ca75fca 100644 --- a/manifests/proxy/swauth.pp +++ b/manifests/proxy/swauth.pp @@ -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}"; diff --git a/manifests/storage/ext4.pp b/manifests/storage/ext4.pp index 53f0d6b2..0d708519 100644 --- a/manifests/storage/ext4.pp +++ b/manifests/storage/ext4.pp @@ -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 |> + } diff --git a/manifests/storage/loopback.pp b/manifests/storage/loopback.pp index a0d81f20..ed9fd56f 100644 --- a/manifests/storage/loopback.pp +++ b/manifests/storage/loopback.pp @@ -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, diff --git a/manifests/storage/mount.pp b/manifests/storage/mount.pp index a121576f..1d0dffe5 100644 --- a/manifests/storage/mount.pp +++ b/manifests/storage/mount.pp @@ -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}" |> + } } diff --git a/manifests/storage/object.pp b/manifests/storage/object.pp index 2bb7302b..e2b13ff2 100644 --- a/manifests/storage/object.pp +++ b/manifests/storage/object.pp @@ -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}"], } diff --git a/manifests/storage/server.pp b/manifests/storage/server.pp index c032b03d..e12a0e49 100644 --- a/manifests/storage/server.pp +++ b/manifests/storage/server.pp @@ -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 { diff --git a/manifests/storage/xfs.pp b/manifests/storage/xfs.pp index 372eeaf1..ffd0c678 100644 --- a/manifests/storage/xfs.pp +++ b/manifests/storage/xfs.pp @@ -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 |> + } diff --git a/spec/classes/swift_keystone_dispersion_spec.rb b/spec/classes/swift_keystone_dispersion_spec.rb index 9b6c0776..e2f07e15 100644 --- a/spec/classes/swift_keystone_dispersion_spec.rb +++ b/spec/classes/swift_keystone_dispersion_spec.rb @@ -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 diff --git a/spec/classes/swift_proxy_spec.rb b/spec/classes/swift_proxy_spec.rb index e5824308..3bfe39fb 100644 --- a/spec/classes/swift_proxy_spec.rb +++ b/spec/classes/swift_proxy_spec.rb @@ -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| diff --git a/spec/classes/swift_storage_account_spec.rb b/spec/classes/swift_storage_account_spec.rb index acfe5a50..08f35cc9 100644 --- a/spec/classes/swift_storage_account_spec.rb +++ b/spec/classes/swift_storage_account_spec.rb @@ -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 diff --git a/spec/classes/swift_storage_all_spec.rb b/spec/classes/swift_storage_all_spec.rb index 5d8e1eeb..3779a6f0 100644 --- a/spec/classes/swift_storage_all_spec.rb +++ b/spec/classes/swift_storage_all_spec.rb @@ -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', diff --git a/spec/classes/swift_storage_container_spec.rb b/spec/classes/swift_storage_container_spec.rb index 3c087a9d..e6ec211b 100644 --- a/spec/classes/swift_storage_container_spec.rb +++ b/spec/classes/swift_storage_container_spec.rb @@ -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 diff --git a/spec/classes/swift_storage_object_spec.rb b/spec/classes/swift_storage_object_spec.rb index b513ce6d..9bebf5c8 100644 --- a/spec/classes/swift_storage_object_spec.rb +++ b/spec/classes/swift_storage_object_spec.rb @@ -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 diff --git a/spec/defines/swift_storage_mount_spec.rb b/spec/defines/swift_storage_mount_spec.rb index 672975b2..2cea69ff 100644 --- a/spec/defines/swift_storage_mount_spec.rb +++ b/spec/defines/swift_storage_mount_spec.rb @@ -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 diff --git a/spec/defines/swift_storage_server_spec.rb b/spec/defines/swift_storage_server_spec.rb index d9fc6184..89eb5fca 100644 --- a/spec/defines/swift_storage_server_spec.rb +++ b/spec/defines/swift_storage_server_spec.rb @@ -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 diff --git a/spec/defines/swift_storage_xfs_spec.rb b/spec/defines/swift_storage_xfs_spec.rb index 47c1698b..8b0c76a5 100644 --- a/spec/defines/swift_storage_xfs_spec.rb +++ b/spec/defines/swift_storage_xfs_spec.rb @@ -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