Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Set seltype for swapfile #66

Merged
merged 1 commit into from
Aug 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions manifests/files.pp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@
mode => '0600',
require => Exec["Create swap file ${swapfile}"],
}

if $::selinux {
File[$swapfile] {
seltype => 'swapfile_t',
}
}

swap_file { $swapfile:
ensure => 'present',
require => File[$swapfile]
Expand Down
3 changes: 3 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
let(:facts) do
{
:memorysize => '1.00 GB',
selinux: true,
}
end

Expand Down Expand Up @@ -50,6 +51,7 @@
:fqdn => 'files',
:parameter_tests => 'files_hiera_merge',
:memorysize => '1.00 GB',
:selinux => true,
}
end

Expand Down Expand Up @@ -105,6 +107,7 @@
{
:osfamily => 'RedHat',
:memorysize => '1.00 GB',
:selinux => true,
}
end
let(:validation_params) do
Expand Down
9 changes: 8 additions & 1 deletion spec/defines/files_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
osfamily: 'RedHat',
operatingsystemrelease: '7',
concat_basedir: '/tmp',
memorysize: '1.00 GB'
memorysize: '1.00 GB',
selinux: true,
}
end

Expand Down Expand Up @@ -146,6 +147,7 @@
'/mnt/swap.resizeme' => existing_swap_kb,
},
swapfile_sizes_csv: "/mnt/swap.resizeme||#{existing_swap_kb}",
selinux: true,
}
end

Expand Down Expand Up @@ -195,6 +197,7 @@
concat_basedir: '/tmp',
memorysize: '1.00 GB',
swapfile_sizes: nil,
selinux: true,
}
end
it do
Expand Down Expand Up @@ -222,6 +225,7 @@
'/mnt/swap.differentname' => '204796', # 200MB
},
swapfile_sizes_csv: "/mnt/swap.differentname||#{existing_swap_kb}",
selinux: true,
}
end
it do
Expand Down Expand Up @@ -257,6 +261,7 @@
memorysize: '1.00 GB',
swapfile_sizes: "/mnt/swap.resizeme#{existing_swap_kb}",
swapfile_sizes_csv: "/mnt/swap.resizeme||#{existing_swap_kb}",
selinux: true,
}
end

Expand Down Expand Up @@ -307,6 +312,7 @@
memorysize: '1.00 GB',
swapfile_sizes: nil,
swapfile_sizes_csv: nil,
selinux: true,
}
end
it do
Expand All @@ -332,6 +338,7 @@
memorysize: '1.00 GB',
swapfile_sizes: "/mnt/swap.differentname#{existing_swap_kb}",
swapfile_sizes_csv: "/mnt/swap.differentname||#{existing_swap_kb}",
selinux: true,
}
end
it do
Expand Down