added exception

This commit is contained in:
Rilindo Foster 2016-05-20 20:53:58 -05:00
parent 5ded388eb3
commit 9774525d56
1 changed files with 22 additions and 19 deletions

View File

@ -13,7 +13,8 @@ clientbucket_path ||= "/var/lib/puppet/clientbucket"
available_files = Array.new
Find.find(clientbucket_path) do |file_path|
begin
Find.find(clientbucket_path) do |file_path|
# Skip directories and "contents" files
next if FileTest.directory?(file_path)
@ -39,8 +40,10 @@ Find.find(clientbucket_path) do |file_path|
end
end
rescue
puts "Unable to open file path #{clientbucket_path}"
end
# See if we found any files for the user
if available_files.length == 0
puts "No files with path #{target_path} exist in the clientbucket"