我想把一个命令的输出作为Chef属性,放到execute资源或bash资源中。有人可以帮助我如何设置吗?
ruby_block "something" do
block do
#tricky way to load this Chef::Mixin::ShellOut utilities
Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut)
command = 'cat #{fileName}'
command_out = shell_out(command)
node.set['my_attribute'] = command_out.stdout
end
action :create
end
如何在上述代码中使用属性...
command = 'cat #{fileName}'
,@SASI 应该使用双引号来启用解析(即command = "cat #{fileName}"
)。 - scones