【发布时间】:2017-11-09 06:23:12
【问题描述】:
我正在尝试获取文件夹中文件的计数,并根据计数跳过或执行更多资源。
file 'C:\Users\Desktop\Chef-file\count.txt' do
dir = 'C:\Users\Desktop\Chef-Commands'
count = Dir[File.join(dir, '**', '*')].count { |file| File.file?(file)}
content count
end
但出现以下错误
Chef::Exceptions::ValidationFailed: Property content must be one of: String, nil! You passed 0.
我对 chef 和 ruby 很陌生,所以想知道如何修复/解决这个问题。
得到count后,如何在其他资源中查看其值?
也想知道这是否是正确的方法。
谢谢
【问题讨论】:
标签: ruby chef-infra chef-recipe cookbook