ruby - 如何查看上传失败的具体 Recipe ?

标签 ruby chef-infra chef-recipe cookbook

我尝试上传带有依赖项的 Recipe ,这是一个日志:

[root@redhat cookbooks]# knife cookbook upload reference-app --include-dependencies
Uploading my-cookbook  [0.1.0]
Uploading maven          [1.2.0]
Uploading hipsnip-jetty  [0.9.0]
Uploading ark            [0.9.0]
Uploading java           [1.29.0]
Uploading windows        [1.34.8]
Uploading 7-zip          [1.0.2]
Uploading chef_handler   [1.1.6]
WARNING: Uploaded 8 cookbooks ok but 2 cookbooks upload failed.

都是日志。有没有办法确定哪些菜谱到底失败了?

最佳答案

使用 verbose 标志会告诉您上传不正确的原因。

例如,我在 apt Recipe 中添加了一些错误的代码...

[scarman@coldlight cookbooks]$ knife cookbook upload apt --include-dependencies -n -V
Uploading apt            [2.6.0]
INFO: Validating ruby files
FATAL: Cookbook file recipes/default.rb has a ruby syntax error:
FATAL: /home/scarman/DevOps/cookbooks/apt/recipes/default.rb:29: `@#' is not allowed as an instance variable name
FATAL: /home/scarman/DevOps/cookbooks/apt/recipes/default.rb:29: syntax error, unexpected end-of-input, expecting '('
FATAL: uha897*@S::@#!!
FATAL:             ^

还把我的网络关了一会儿...

[scarman@coldlight cookbooks]$ knife cookbook upload apt --include-dependencies -n -V
ERROR: Error connecting to https://api.opscode.com/organizations/cls-chef/cookbooks?num_versions=all, retry 1/5
ERROR: Error connecting to https://api.opscode.com/organizations/cls-chef/cookbooks?num_versions=all, retry 2/5
ERROR: Error connecting to https://api.opscode.com/organizations/cls-chef/cookbooks?num_versions=all, retry 3/5
ERROR: Error connecting to https://api.opscode.com/organizations/cls-chef/cookbooks?num_versions=all, retry 4/5
ERROR: Error connecting to https://api.opscode.com/organizations/cls-chef/cookbooks?num_versions=all, retry 5/5
ERROR: Network Error: Error connecting to https://api.opscode.com/organizations/cls-chef/cookbooks?num_versions=all - getaddrinfo: Name or service not known
Check your knife configuration and network settings

这应该能让您更深入地了解失败的原因。

关于ruby - 如何查看上传失败的具体 Recipe ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27479662/

相关文章:

chef-infra - 参数化 Chef Recipe

linux - 使用 Chef 配方将多行附加到配置文件

ruby - 如何从 Ruby 运行 Excel 宏?

ruby-on-rails - 如何在一台服务器上运行多个微型 Rub​​y (Rack) 应用程序?

ruby - 对二维数组进行分组

chef-infra - 如何将 Berkshelf 与 Chef-solo 一起使用?

ubuntu - 使用 Chef 在 Ubuntu 中安装 ffmpeg 因 yasm 版本错误而失败

ruby - 使文件在Elastic MapReduce上本地可用

mysql - OpsWorks/Chef : multiple versions of a cookbook are required

chef-infra - 是什么卡住了我的 Recipe ?