Chef infra 厨师机器执行命名错误:未定义的方法“[]';

Chef infra 厨师机器执行命名错误:未定义的方法“[]';,chef-infra,chef-recipe,Chef Infra,Chef Recipe,我试图优雅地停止,然后在一个远程设备上启动一个正在运行的服务 任何使用“machine_execute”的尝试都会导致一个异常,表明存在未定义的方法,搜索该异常会产生一些结果fr Vagrant(我没有使用)和端口未打开(这不应该是问题) 这是我失败的简单测试用例,下面是我想要使用的完整链 我试着尽可能地简化它,但收效甚微。提前感谢您的帮助 machine execute "service #{solrCore} restart" do machine 'machineName' end 这是

我试图优雅地停止,然后在一个远程设备上启动一个正在运行的服务

任何使用“machine_execute”的尝试都会导致一个异常,表明存在未定义的方法,搜索该异常会产生一些结果fr Vagrant(我没有使用)和端口未打开(这不应该是问题)

这是我失败的简单测试用例,下面是我想要使用的完整链

我试着尽可能地简化它,但收效甚微。提前感谢您的帮助

machine execute "service #{solrCore} restart" do
machine 'machineName'
end
这是我尝试的完整示例:

  machine_execute 'pwd' do
    machine "machineName"
    command 'pwd'
    Chef::Resource::Notification.new('stop', :run, self)
end


#define the service - does nothing
service solrCore do
    action :nothing
end

#do something that triggers
machine_execute 'start' do
    machine "machineName"
    command 'pwd' #test
    Chef::Log.info('triggers start')
    action :nothing
    notifies :start, run_context.resource_collection.find(:service => "#{solrCore}")
end

execute 'stop' do
    # some stuff
    # on success...
    machine "machineName"
    command 'pwd' #test
    Chef::Log.info('triggers restart')
    notifies :stop, run_context.resource_collection.find(:service => "#{solrCore}"), :immediately
    notifies :run, 'machine_execute[start]'
end

这并不是Chef擅长的事情,如果可能的话,我强烈建议使用一个专门的过程编排工具。@coderanger您好,您有什么建议吗?其他人提到了我将要看到的栖息地。如果我们能保留我们目前的厨师配置,并有一些东西,发挥良好的厨师,然后这是一个巨大的优势。谢谢