Skip to content

Commit

Permalink
add guard to execute
Browse files Browse the repository at this point in the history
TelekomLabs-DCO-1.1-Signed-off-by: Edmund Haselwanter <[email protected]> (github: ehaselwanter)
  • Loading branch information
ehaselwanter committed Jan 5, 2015
1 parent 44445c5 commit f7fb196
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions recipes/minimize_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
paths.each do |folder|
execute "remove write permission from #{folder}" do
command "chmod go-w -R #{folder}"
not_if "find #{folder} -perm -go+w -type f | wc -l | egrep '^0$'"
end
end

Expand Down
7 changes: 7 additions & 0 deletions spec/recipes/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
# therefore we set it manually here
node.set['sysctl']['conf_dir'] = '/etc/sysctl.d'
node.set['cpu']['0']['vendor_id'] = 'GenuineIntel'
node.set['env']['extra_user_paths'] = []

paths = %w(/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin) + node['env']['extra_user_paths']
paths.each do |folder|
stub_command("find #{folder} -perm -go+w -type f | wc -l | egrep '^0$'").and_return(false)
end

end.converge(described_recipe)
end

Expand Down

0 comments on commit f7fb196

Please sign in to comment.