I'm writing a Chef InSpec test in ruby to check the contents of the files for 'umask 077'. The issue is that for a few of the files in my array that I'm checking for do not exist. I'm trying to exclude nil files and re-push them, but it seems to attempt to check all of the files anyway. Any thoughts?
Here is my code:
control 'auth-default-umask' do
impact 0.5
title 'Default umask'
desc 'DISA RHEL6 STIG (V1R2)'
%w(/etc/profile /etc/bashrc /etc/csh.login /etc/.login).each do |umask_file|
filecheck = []
unless umask_file == nil
filecheck.push(umask_file)
describe directory(filecheck) do
its('content') { should match /umask 077/ }
end
end
end
end