Chef infra 未在厨师中执行配方

Chef infra 未在厨师中执行配方,chef-infra,apt,recipe,cookbook,Chef Infra,Apt,Recipe,Cookbook,我正在做一个简单的配方,让apt升级整个系统 include_recipe "apt" execute "apt-get upgrade -y" do command "apt-get upgrade -y" action :nothing end 但它从未运行过: chef-solo -j node.json -W Recipe: up2date::default * execute[apt-get upgrade -y] action nothing

我正在做一个简单的配方,让apt升级整个系统

include_recipe "apt"

execute "apt-get upgrade -y" do
        command "apt-get upgrade -y"
        action :nothing
end
但它从未运行过:

chef-solo -j node.json -W

Recipe: up2date::default
  * execute[apt-get upgrade -y] action nothing[2012-11-12T13:05:04+01:00] 
    INFO: Processing execute[apt-get upgrade -y] 
    action nothing (up2date::default line 12)  (up to date)
不明白为什么

是否有更好/更干净的方法?

如果您包含“apt”配方,则不必创建执行[apt get upgrade-y]资源。或者,如果您不想包含“apt”配方,则使用

execute "apt-get upgrade -y" do
    command "apt-get upgrade -y"
    action :run
end
但由于run是默认操作,name是默认命令,所以可以缩短为

execute "apt-get upgrade -y"

谢谢只需执行“apt get upgrade-y”,而不执行“do”块?您是说“apt”配方将自动运行apt get upgrade吗?因为这对我来说似乎不合适。是的,会的。在您的情况下,可能是您的食谱中的某些内容覆盖了资源。我不知道。