我正在运行一个依赖于多个配方的配方,其中一个尝试克隆github仓库,并在其属性/ fair.rb(https://github.com/priestjim/chef-openresty/blob/master/attributes/fair.rb)的cookbook中将url作为属性提供:
# For more information checkout https://github.com/gnosek/nginx-upstream-fair
default['openresty']['fair']['url'] = 'git://github.com/gnosek/nginx-upstream-fair.git'
我需要过度使用这个属性来给https端点代替SSH,所以在我的食谱中,我创建了属性/ fair.rb并放下:
override['openresty']['fair']['url'] = 'https://github.com/gnosek/nginx-upstream-fair.git'
但是当我使用vagrant运行Chef solo时,它会失败并显示以下内容:
Mixlib::ShellOut::ShellCommandFailed
==> default: ------------------------------------
==> default: Expected process to exit with [0], but received '128'
==> default: ---- Begin output of git ls-remote "git://github.com/gnosek/nginx-upstream-fair.git" "master*" ----
==> default: STDOUT:
==> default: STDERR: fatal: unable to connect to github.com:
==> default: github.com[0: 192.30.252.131]: errno=Connection timed out
==> default: ---- End output of git ls-remote "git://github.com/gnosek/nginx-upstream-fair.git" "master*" ----
==> default: Ran git ls-remote "git://github.com/gnosek/nginx-upstream-fair.git" "master*" returned 128
==> default:
==> default: Resource Declaration:
==> default: ---------------------
==> default: # In /tmp/vagrant-chef/97b7f5ef6e972aa934bfb7ea6a5db3bb/cookbooks/openresty/recipes/fair_module.rb
==> default:
==> default: 26: git module_path do
==> default: 27: repository node['openresty']['fair']['url']
==> default: 28: reference 'master'
==> default: 29: action :checkout
==> default: 30: not_if { ::File.exists?(module_path) }
==> default: 31: end
==> default: 32:
==> default:
==> default: Compiled Resource:
==> default: ------------------
==> default: # Declared in /tmp/vagrant-chef/97b7f5ef6e972aa934bfb7ea6a5db3bb/cookbooks/openresty/recipes/fair_module.rb:26:in `from_file'
==> default:
==> default: git("/var/chef/cache/nginx-upstream-fair") do
==> default: action [:checkout]
==> default: retries 0
==> default: retry_delay 2
==> default: default_guard_interpreter :default
==> default: destination "/var/chef/cache/nginx-upstream-fair"
==> default: enable_checkout true
==> default: revision "master"
==> default: remote "origin"
==> default: checkout_branch "deploy"
==> default: declared_type :git
==> default: cookbook_name :openresty
==> default: recipe_name "fair_module"
==> default: repository "git://github.com/gnosek/nginx-upstream-fair.git"
==> default: not_if { #code block }
==> default: end
Ran git ls-remote "git://github.com/gnosek/nginx-upstream-fair.git" "master*" returned 128
==> default: [2016-02-23T01:03:00+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
正如您所看到的,仍然会出于某种原因获取ssh端点。知道为什么吗?
答案 0 :(得分:0)
在openresty cookbook的包装中,确保它依赖于metadata.rb
中的openresty。这将确保以正确的顺序加载内容。