简体   繁体   English

即使食谱可用并且设置了依赖项,Chef 中也没有此类食谱异常 - AWS OpsWorks

[英]No such cookbook exception in Chef even if cookbook is available and dependency is set - AWS OpsWorks

I am a beginner in Chef and AWS OpsWorks.我是 Chef 和 AWS OpsWorks 的初学者。 I was trying to experiment with custom recipes.我试图尝试定制食谱。 I created a git repository having a directory test_cookbook , and configured chef to get cookbooks from it.我创建了一个具有目录test_cookbook的 git 存储库,并配置厨师从中获取食谱。 Inside that, I created files like below;在其中,我创建了如下文件;

test_cookbook
  |_metadata.rb
  |_recipes
    |_testrecipe.rb

below is the content of metadata.rb以下是metadata.rb的内容

depends 'magic_shell'

magic_shell is an open cookbook and is available in chef supermarket https://supermarket.chef.io/cookbooks/magic_shell magic_shell 是一本开放的食谱,在厨师超市https://supermarket.chef.io/cookbooks/magic_shell 有售

While I try to execute the testrecipe , I am getting below error;当我尝试执行testrecipe时,我遇到了错误;

[2021-01-12T09:52:23+00:00] INFO: HTTP Request Returned 412 Precondition Failed: No such cookbook: magic_shell
 
================================================================================
Error Resolving Cookbooks for Run List:
================================================================================
 
 
Missing Cookbooks:
------------------
No such cookbook: magic_shell

Can somebody tell me why this is happening and how to fix this?有人可以告诉我为什么会发生这种情况以及如何解决这个问题吗?

The dependency is not packaged.未打包依赖项。

As per the documentation根据文档

You can use Berkshelf to package your cookbook dependencies locally, upload the package to Amazon S3, and modify your stack to use the package on Amazon S3 as a cookbook source.您可以使用 Berkshelf 在本地 package 您的食谱依赖项,将 package 上传到 Amazon S3,并修改您的堆栈以使用 Amazon S3A67F6B7D8 上的 ZEFE90A8E604A7C840E88D03A67F6B7D8 作为食谱源。

OR pull the dependency using Berksfile and push them to your git source.或者使用 Berksfile 拉取依赖项并将它们推送到您的 git 源。

For example, I have a dependency for opsworks_helpers in metadata.rb例如,我在metadata.rb中有opsworks_helpers的依赖项

 $ grep depends metadata.rb
 depends   'opsworks_helpers'

and my current directory structure is like this我当前的目录结构是这样的

    $ tree
    .
    ├── collectd
    ..
    │   │   └── collectd.rb
    │   ├── metadata.rb

    └── opsworks_helpers
        ├── Berksfile
        ├── CHANGELOG.md
        ├── Gemfile
    ...
                    └── serverspec
                        └── spec_helper.rb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM