用测试厨房打印变种 - 厨师

时间:2017-03-22 12:12:59

标签: ruby chef test-kitchen

我正在与Chef和Test Kitchen合作,我在安装Apache 2.2时遇到了一些问题,我正在阅读我的食谱(https://github.com/sous-chefs/apache2/blob/master/recipes/default.rb)的食谱,我想知道安装Apache后这个食谱是如何工作的我想在启动食谱时打印一些变量:

apply plugin: 'com.google.gms.google-services'

Chef官方文档的一个例子:

node['platform_family']
node['platform_version']

但我写了我的食谱:

Chef::Log.fatal('You did not accept the license (set node["splunk"]["accept_license"] to true)')

我得到了日志,但是我写的文本完全相同,我无法连接或直接调用var。

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:2)

它是一个红宝石字符串插值的例子,请用它作为: -

Chef::Log.info("PERSONAL-LOG, #{node['platform_family']}")

http://ruby-for-beginners.rubymonstas.org/bonus/string_interpolation.html