Chef - 将多个属性打印到日志

Chef - print multiple attributes to the log

背景。在我的环境中,我无法直接访问将应用我的配方的服务器,我能做的最好的事情就是在 运行.

失败后获取日志文件

我想将平台和最重要的版本发送到日志文件

log 'OS version'
   message { node['platform_family'] node['platform_version'] }
   level  :warn
end

但是 Rubocop 抱怨我怀疑我没有正确格式化变量。

正确的做法是什么?

您需要将它们插入到一个字符串中。喜欢:message "#{node['platform_family']} #{node['platform_version']}"