File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 102
102
when 'debian'
103
103
default [ 'ntp' ] [ 'leapfile_managed_by_os' ] = true
104
104
default [ 'ntp' ] [ 'service' ] = 'ntp'
105
- default [ 'ntp' ] [ 'apparmor_enabled' ] = true if File . exist? ( '/etc/init.d/ apparmor' )
105
+ default [ 'ntp' ] [ 'apparmor_enabled' ] = true if File . exist? ( '/sys/module/apparmor/parameters/enabled' ) && ( File . open ( '/sys/module/ apparmor/parameters/enabled' ) == 'Y ')
106
106
default [ 'ntp' ] [ 'leapfile' ] = '/usr/share/zoneinfo/leap-seconds.list'
107
107
when 'rhel' , 'fedora' , 'amazon'
108
108
default [ 'ntp' ] [ 'leapfile_managed_by_os' ] = true
Original file line number Diff line number Diff line change 196
196
describe 'on Ubuntu' do
197
197
let ( :chef_run ) { ChefSpec ::SoloRunner . new ( platform : 'ubuntu' , version : '20.04' ) . converge ( 'ntp::default' ) }
198
198
199
- it 'sets the apparmor_enabled attribute to true when /etc/init.d /apparmor exists' do
199
+ it 'sets the apparmor_enabled attribute to true when /sys/module /apparmor/parameters/enabled exists' do
200
200
allow ( File ) . to receive ( :exist? ) . and_call_original
201
- allow ( File ) . to receive ( :exist? ) . with ( '/etc/init.d /apparmor' ) . and_return ( true )
201
+ allow ( File ) . to receive ( :exist? ) . with ( '/sys/module /apparmor/parameters/enabled ' ) . and_return ( true )
202
202
expect ( ntp [ 'apparmor_enabled' ] ) . to eq ( true )
203
203
end
204
204
205
- it 'sets the apparmor_enabled attribute to false when /etc/init.d /apparmor does not exist' do
205
+ it 'sets the apparmor_enabled attribute to false when /sys/module /apparmor/parameters/enabled does not exist' do
206
206
allow ( File ) . to receive ( :exist? ) . and_call_original
207
- allow ( File ) . to receive ( :exist? ) . with ( '/etc/init.d /apparmor' ) . and_return ( false )
207
+ allow ( File ) . to receive ( :exist? ) . with ( '/sys/module /apparmor/parameters/enabled ' ) . and_return ( false )
208
208
expect ( ntp [ 'apparmor_enabled' ] ) . to eq ( false )
209
209
end
210
210
end
You can’t perform that action at this time.
0 commit comments