我有一个自我主持的厨师服务器。 我可以knife upload到该服务器,否则与之交互。 因此,我的knife.rb工作正常。 我最近参考了一本食谱,以使其成为一个相关的食谱家庭的基础。
问题是我想这个食谱是私人的,所以它只存在于我的私人厨师服务器上。 不幸的是,我不能在我的其他食谱上berks install 。 我在厨师服务器上指出了我的Berksfile :
source https://chef.myhost.com
这不起作用。 我认为这是因为该URL是厨师pipe理,而不是厨师服务器API。 但是,我不知道如何让Berkshelf识别我的厨师服务器并使用它的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)
所以,它试图访问https://chef.myhost.com/universe ,但它popup到/注册页面,因为这是厨师pipe理,而不是厨师服务器API …但我不知道在哪里的API如果有的话,默认情况下可以访问。 我已经阅读了过去一小时的各种文档,并没有出现什么…
原来, Berksfile中的source实际上是Berkshelf API服务器的URL, 而不是 Chef Server API 。
在做好gem install berkshelf-api并configurationconfig.json来使用我的Chef Server作为端点之后,我能够运行berks-api ,然后在我的Chef Server上使用端口26200作为Berksfile source的目标。
从这里, berks install和berks upload都工作。
我只是和你有同样的问题。 由于在一个环境重新更新到更新版本的厨师服务器和厨师DK,我去使用berkshelf依赖pipe理。
我的一个cookbook的metadata.rb文件,让我们把它称为second_local_cookbook引用first_local_cookbook是这样的:
depends 'first_local_cookbook'
那么当我运行:
berks install
在second_local_cookbook上确定食谱依赖关系,命令将以与你相同的方式失败:
Fetching cookbook index from https://supermarket.chef.io... Unable to satisfy constraints on package first_local_cookbook, which does not exist, due to solution constraint (second_local_cookbook = 0.1.0). Solution constraints that may result in a constraint on first_local_cookbook: [(second_local_cookbook = 0.1.0) -> (first_local_cookbook >= 0.0.0)] Missing artifacts: first_local_cookbook
我没有尝试你的解决scheme,因为我希望有一个简单的答案来引用本地私人食谱,而无需安装新的服务器API。 我在berkshelf的GitHub( https://github.com/berkshelf/berkshelf/issues/892 )中发现了这个封闭的问题。 要从另一本食谱中引用本地食谱, 只需在元数据区域之前引用second_local_cookbook的Berks文件中的first_local_cookbook 即可 :
source 'https://api.berkshelf.com' cookbook 'first_local_cookbook', path: '../first_local_cookbook' metadata
然后运行berks安装将会成功:
berks install Resolving cookbook dependencies... Fetching 'first_local_cookbook' from source at ../first_local_cookbook Fetching 'second_local_cookbook' from source at . ...
然后我可以成功地运行berks上传:
berks upload second_local_cookbook --no-freeze Uploaded second_local_cookbook (0.1.0) to: 'https://chefserver:443/organizations/organization'