From a307f9eefc8b71eda17e532021760bafedbb5fc7 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sat, 27 Jan 2024 15:09:15 +0100 Subject: [PATCH] Apply puppet-lint to acceptance test example --- spec/acceptance/class_spec.rb | 41 ++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 4e06ff5a..828aae33 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -19,14 +19,14 @@ class { 'selinux': mode => 'enforcing' } selinux::permissive { 'puppet_selinux_test_policy_t': } selinux::port { 'puppet_selinux_test_policy_port_t/tcp': - seltype => 'puppet_selinux_test_policy_port_t', - port => 55555, + seltype => 'puppet_selinux_test_policy_port_t', + port => 55555, protocol => 'tcp', } } # just something simple I found via Google: - file {'/tmp/selinux_simple_policy.te': + file { '/tmp/selinux_simple_policy.te': ensure => 'file', content => @("EOF") module puppet_selinux_simple_policy 1.0; @@ -40,7 +40,7 @@ class file { read getattr }; | EOF } - file {'/tmp/selinux_test_policy.te': + file { '/tmp/selinux_test_policy.te': ensure => 'file', content => @("EOF") policy_module(puppet_selinux_test_policy, 1.0.0) @@ -56,48 +56,49 @@ class file { read getattr }; selinux::module { 'puppet_selinux_simple_policy': source_te => 'file:///tmp/selinux_simple_policy.te', builder => 'simple', - require => File['/tmp/selinux_simple_policy.te'] + require => File['/tmp/selinux_simple_policy.te'], } selinux::module { 'puppet_selinux_test_policy': - source_te => 'file:///tmp/selinux_test_policy.te', - builder => 'refpolicy', - require => File['/tmp/selinux_test_policy.te'] + source_te => 'file:///tmp/selinux_test_policy.te', + builder => 'refpolicy', + require => File['/tmp/selinux_test_policy.te'], } if $have_selinux_ruby_library { - Class['selinux'] -> - file { '/tmp/test_selinux_fcontext': content => 'TEST', seltype => 'puppet_selinux_test_policy_exec_t', + require => Class['selinux'], } - selinux::fcontext {'/tmp/fcontexts_source(/.*)?': + selinux::fcontext { '/tmp/fcontexts_source(/.*)?': seltype => 'puppet_selinux_test_policy_exec_t', } - selinux::fcontext::equivalence {'/tmp/fcontexts_equivalent': + selinux::fcontext::equivalence { '/tmp/fcontexts_equivalent': target => '/tmp/fcontexts_source', } file {['/tmp/fcontexts_source', '/tmp/fcontexts_equivalent']: - ensure => 'directory', + ensure => 'directory', require => [Selinux::Fcontext['/tmp/fcontexts_source(/.*)?'], Selinux::Fcontext::Equivalence['/tmp/fcontexts_equivalent']], } - file {['/tmp/fcontexts_source/define_test', '/tmp/fcontexts_equivalent/define_test']: - ensure => file, - notify => Exec["/sbin/restorecon -FR /tmp/fcontexts_*"] + file { ['/tmp/fcontexts_source/define_test', '/tmp/fcontexts_equivalent/define_test']: + ensure => file, + notify => Exec['/sbin/restorecon -FR /tmp/fcontexts_*'], } - exec {'/sbin/restorecon -FR /tmp/fcontexts_*': - # this is needed because puppet creates files with the wrong context as - # it runs unconfined and only becomes idempotent after the second run. + exec { '/sbin/restorecon -FR /tmp/fcontexts_*': + # this is needed because puppet creates files with the wrong context as + # it runs unconfined and only becomes idempotent after the second run. refreshonly => true, } # test purging - resources {['selinux_fcontext', 'selinux_fcontext_equivalence']: purge => true } + resources { ['selinux_fcontext', 'selinux_fcontext_equivalence']: + purge => true, + } } EOS end