Berksfile 源无法识别自托管的 Chef 服务器

Rot*_*ard 6 chef berkshelf

我有一个自托管的 Chef 服务器。我可以knife upload访问该服务器,并以其他方式与之交互。因此,我的knife.rb工作正常。我最近对一本食谱进行了参数化,以使其成为一系列相关食谱的基础。

问题是我希望这本食谱是私有的,所以它只存在于我的私人 Chef 服务器上。不幸的是,我不能berks install在我的其他食谱上做。我指着我Berksfile的厨师服务器:

source https://chef.myhost.com

这不起作用。我认为这是因为该 URL 用于 Chef Manage,而不是 Chef Server API。但是,我不知道如何让 Berkshelf 识别我的 Chef Server 并使用其 API。

完整的错误:

> berks install
Resolving cookbook dependencies...
Fetching 'blog_role' from source at .
Fetching cookbook index from chef.myhost.com...
Error retrieving universe from source: chef.myhost.com * [Berkshelf::APIClient::BadResponse] bad response #<Faraday::Response:0x36ae618 @on_complete_callbacks=[], @env=#<Faraday::Env @method=:get @body="<html><body>You are being <a href=\"chef.myhost.com:443/signup\">redirected</a>.</body></html>" @url=#<URI::HTTPS:0x36891f0 URL:chef.myhost.com/universe> @request=#<Faraday::RequestOptions timeout=30, open_timeout=30> @request_headers={"User-Agent"=>"Faraday v0.9.1"} @ssl=#<Faraday::SSLOptions (empty)> @response_headers={"server"=>"ngx_openresty/1.4.3.6", "date"=>"Sun, 08 Feb 2015 19:49:10 GMT", "content-type"=>"text/html; charset=utf-8", "transfer-encoding"=>"chunked", "connection"=>"close", "status"=>"302 Found", "strict-transport-security"=>"max-age=631138519", "x-frame-options"=>"DENY", "x-webkit-csp"=>"default-src 'self' chrome-extension:; connect-src 'self' chrome-extension:; font-src 'self' themes.googleusercontent.com chrome-extension:; frame-src 'none' chrome-extension:; img-src 'self' ssl.google-analytics.com chrome-extension: data:; media-src 'none' chrome-extension:; object-src 'none' chrome-extension:; script-src 'self' ssl.google-analytics.com 'unsafe-inline' chrome-extension:; style-src 'self' 'unsafe-inline' fonts.googleapis.com chrome-extension:; script-nonce REDACTED;", "x-xss-protection"=>"1", "location"=>"chef.myhost.com:443/signup", "x-ua-compatible"=>"IE=Edge,chrome=1", "cache-control"=>"no-cache", "set-cookie"=>"chef-manage=REDACTED; path=/; secure; HttpOnly", "x-request-id"=>"REDACTED", "x-runtime"=>"0.034395"} @status=302>>
Unable to satisfy constraints on package source_deploy, which does not exist, due to solution constraint (app_role = 0.9.1). Solution constraints that may result in a constraint on source_deploy: [(app_role = 0.9.1) -> (source_deploy >= 0.0.0)]
Missing artifacts: source_deploy
Demand that cannot be met: (app_role = 0.9.1)
Unable to find a solution for demands: app_role (0.9.1)
Run Code Online (Sandbox Code Playgroud)

所以,它尝试访问https://chef.myhost.com/universe,但它被退回到 /signup 页面,因为这是 Chef Manage,而不是 Chef Server API……但我不知道 API 在哪里默认情况下可以访问,如果有的话。在过去的一个小时里,我阅读了各种文档,但什么也没找到……

Rot*_*ard 1

事实证明,sourcea 中的实际上是Berkshelf API ServerBerksfile的 URL ,而不是Chef Server API

完成gem install berkshelf-api并配置config.json为使用我的 Chef 服务器作为端点后,我能够运行并使用我的 Chef 服务器上berks-api的端口 26200 作为.sourceBerksfile

从这里开始,berks install两者berks upload都起作用了。