chef-infra - Recipe 未在 Chef 中执行

标签 chef-infra apt recipe cookbook

我正在制作一个简单的食谱,apt-get 可以升级整个系统。

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”配方,则不必创建 execute[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"

关于chef-infra - Recipe 未在 Chef 中执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13343416/

相关文章:

amazon-web-services - 如何获取 AWS Autoscaling 启动实例的 pem 文件

chef-infra - Knife bootstrap命令不提示密码

java - 如何在 APT 中访问 @XmlElement 值?

ubuntu - 在 Ubuntu 中删除损坏的包

debian - 在 dist-upgrade 期间如何禁止 apt 删除某些包?

java - Java 可以作为非 root 用户与 Chef 一起安装吗?

ruby - Unicorn 在部署后定期无法重新启动 - PID 过时

shell - 如何在 OpenEmbedded BitBake 配方中递归安装目录结构?

busybox - Yocto busybox 覆盖 coreutils

ruby - Chef - 执行 vs bash 资源