我是最近inheritance了我们以前的devops人的厨师设置的开发人员。 我正在运行Chef 10服务器,并且意识到opscode的nginx cookbook仍然使用nginx 1.2.6版本。 由于已经发布了很多安全补丁,我想转到1.4.1,觉得主厨应该很容易。 然而它已被certificate是噩梦。
我的第一个想法是简单地将nginx的食谱“定制”,并将default['nginx']['version']属性更改为1.4.1,上传食谱并汇集testing服务器。 我看着它取得新版本的食谱(我记得要更新元数据),并且在1.2.6版本中继续忽略它。
然后我想我应该重写我正在使用的angular色的属性(rails_tier_web是angular色的名称)。 与一位更有经验的厨师人员谈话时,他提醒说不要这样做,因为angular色不能按照烹饪书的方式进行版本pipe理。 不过,阅读cookbook的文档,他们告诉你在你的angular色中使用override属性,这就是我所做的:
override_attributes( 'nginx' => { 'source' => { 'version' => '1.4.1', 'prefix' => '/opt/nginx-1.4.1' }, 'version' => '1.4.1' } )
但是当我收敛的时候,我仍然在日志输出中看到1.2.6的痕迹。
[2013-07-15T18:52:03-04:00] INFO: Processing remote_file[http://nginx.org/download/nginx-1.2.6.tar.gz] action create (nginx::source line 56) [2013-07-15T18:52:05-04:00] INFO: remote_file[http://nginx.org/download/nginx-1.2.6.tar.gz] updated
然后在那之后
Mixlib::ShellOut::ShellCommandFailed ------------------------------------ Expected process to exit with [0], but received '1' ---- Begin output of "bash" "/tmp/chef-script20130715-4790-1m689ee" ---- STDOUT: STDERR: /tmp/chef-script20130715-4790-1m689ee: line 2: cd: nginx-1.4.1: No such file or directory ---- End output of "bash" "/tmp/chef-script20130715-4790-1m689ee" ---- Ran "bash" "/tmp/chef-script20130715-4790-1m689ee" returned 1 Resource Declaration: --------------------- # In /var/chef/cache/cookbooks/nginx/recipes/source.rb 84: bash "compile_nginx_source" do 85: cwd ::File.dirname(src_filepath) 86: code <<-EOH 87: tar zxf #{::File.basename(src_filepath)} -C #{::File.dirname(src_filepath)} && 88: cd nginx-#{node['nginx']['source']['version']} && 89: ./configure #{node.run_state['nginx_configure_flags'].join(" ")} && 90: make && make install 91: EOH 92: 93: not_if do 94: nginx_force_recompile == false && 95: node.automatic_attrs['nginx'] && 96: node.automatic_attrs['nginx']['version'] == node['nginx']['source']['version'] && 97: node.automatic_attrs['nginx']['configure_arguments'].sort == configure_flags.sort 98: end 99: 100: notifies :restart, "service[nginx]" 101: end 102: Compiled Resource: ------------------ # Declared in /var/chef/cache/cookbooks/nginx/recipes/source.rb:84:in `from_file' bash("compile_nginx_source") do action "run" retries 0 retry_delay 2 command "\"bash\" \"/tmp/chef-script20130715-4790-1m689ee\"" backup 5 cwd "/var/chef/cache" returns 0 code " tar zxf nginx-1.4.1.tar.gz -C /var/chef/cache &&\n cd nginx-1.4.1 &&\n ./configure --prefix=/opt/nginx-1.2.6 --conf-path=/etc/nginx/nginx.conf --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_stub_status_module &&\n make && make install\n" interpreter "bash" cookbook_name "nginx" recipe_name "source" not_if { #code block } end
我真的很聪明,因为我希望我可以重写一个版本属性,并将其全部归档。 很明显,到目前为止情况并非如此,如果能够帮助,我真的不希望手动修补和/或编辑节点对象。 任何帮助,将不胜感激。
你能不能粘贴你的recipes/source.rb ? 在我看来,你是从源代码安装。 我对吗?
另外,请看一下你的属性/ default.rb中的这一行:
default['nginx']['install_method'] = 'package'
我正在使用上面的行来安装nginx 1.4.0