我的资源如下所示:
execute 'run_command' do
command "chown -R user:user * "
not_if Dir["/home/user/dir1/*"].empty?
end
如果/home/user/dir1
为空,我想确保资源不会执行
答案 0 :(得分:0)
试试这个:
not_if { Dir.entries("/home/user/dir1/").select {|entry| ::File.join("home","user","dir1",entry) and !(entry =='.' || entry == '..') }.empty? }
答案 1 :(得分:-2)
关闭标准错误。例如:
ml