gpt4 book ai didi

git - 在 AWS Opsworks 上使用 Chef 12 无法找到 Chef Community Cookbooks

转载 作者:太空狗 更新时间:2023-10-29 14:05:10 25 4
gpt4 key购买 nike

问题

在 AWS OpsWorks 上运行自定义说明书时,实例会出现 setup_failed 状态,故障日志中显示以下内容:

[2016-03-26T22:53:48+00:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at /var/chef
One version per cookbook
data_bags at /var/chef/runs/62832572-cb67-421a-8309-d831140d7b98/data_bags
nodes at /var/chef/runs/62832572-cb67-421a-8309-d831140d7b98/nodes

[2016-03-26T22:53:48+00:00] INFO: Forking chef instance to converge...
[2016-03-26T22:53:48+00:00] INFO: *** Chef 12.7.2 ***
[2016-03-26T22:53:48+00:00] INFO: Chef-client pid: 17842
[2016-03-26T22:53:49+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: chefzero://localhost:8889/nodes/test1.localdomain
[2016-03-26T22:53:49+00:00] INFO: Setting the run_list to ["recipe[my_cookbook::default]"] from CLI options
[2016-03-26T22:53:49+00:00] INFO: Run List is [recipe[my_cookbook::default]]
[2016-03-26T22:53:49+00:00] INFO: Run List expands to [my_cookbook::default]
[2016-03-26T22:53:49+00:00] INFO: Starting Chef Run for test1.localdomain
[2016-03-26T22:53:49+00:00] INFO: Running start handlers
[2016-03-26T22:53:49+00:00] INFO: Start handlers complete.
[2016-03-26T22:53:49+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found:
[2016-03-26T22:53:49+00:00] INFO: HTTP Request Returned 412 Precondition Failed: No such cookbook: apt

================================================================================
Error Resolving Cookbooks for Run List:
================================================================================

Missing Cookbooks:
------------------
No such cookbook: apt

Expanded Run List:
------------------
* my_cookbook::default

OpsWorks 堆栈已配置

  • Chef 12
  • 使用自定义 Chef Recipe
  • 为自定义说明书使用 Git 存储库

自定义 Recipe 库

为了找到问题的原因,创建了一个 Recipe ,其中包含一个运行 apt-get update 的 Recipe (在 kitchen converge 下按预期运行).这些文件是使用 chef generate cookbook my_cookbook 创建的:

.
└── my_cookbook
├── Berksfile
├── chefignore
├── metadata.rb
├── README.md
├── recipes
│   └── default.rb
├── spec
│   ├── spec_helper.rb
│   └── unit
│   └── recipes
│   └── default_spec.rb
└── test
└── integration
├── default
│   └── serverspec
│   └── default_spec.rb
└── helpers
└── serverspec
└── spec_helper.rb

唯一改变的文件是:

我的 Recipe/Berksfile

source 'https://supermarket.chef.io'    
metadata
cookbook 'apt'

my_cookbook/metadata.rb

...
depends 'apt', '~> 3.0.0'

my_cookbook/recipes/default.rb

include_recipe 'apt::default'

另外,一个 Berksfile 被添加到 repo 的根目录

source 'https://supermarket.chef.io'
cookbook 'apt'

当前的解决方法

当前的解决方法包括使用 berks vendor 下载依赖项,然后将下载的说明书复制到存储库的根目录中,即:

.
├── Berksfile
├── apt
└── my_cookbook

是否有更好的解决方案(将 AWS OpsWorks 与 Chef 12 结合使用)不需要使用自定义说明书显式存储和分发社区说明书?

最佳答案

我也有同样的问题。看起来它应该将 berk pack 与 s3 存储一起使用,但是(对我而言)它增加了另一个级别的复杂性(并且仅对 CI 工具有用,其中由 berkshelf 创建的 cookbook 存档将是方便的“神器”):

In Chef 12 Linux, Berkshelf is no longer installed on stack instances. Instead, we recommend that you use Berkshelf on a local development machine to package your cookbook dependencies locally. Then upload your package, with the dependencies included, to Amazon Simple Storage Service. Finally, modify your Chef 12 Linux stack to use the uploaded package as a cookbook source. For more information, see Packaging Cookbook Dependencies Locally.

来自 here .

关于git - 在 AWS Opsworks 上使用 Chef 12 无法找到 Chef Community Cookbooks,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36242345/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com