Chef在资源'服务[httpd]'上执行动作`start`时出错

时间:2015-02-11 06:09:44

标签: ruby apache centos chef chef-recipe

这是我非常基本的食谱/ default.rb文件;

package "httpd" do
        action :install
end

node["apache"]["sites"].each do |sitename, data|
        document_root = "/content/sites/#{sitename}"

        directory document_root do
                mode "0755"
                recursive true
        end

template "/etc/httpd/conf.d/#{sitename}.conf" do
        source "vhost.erb"
        mode "0644"
        variables(
                :document_root => document_root,
                :port => data["port"],
                :domain => data["domain"]
        )
        notifies :restart, "service[httpd]"
end

end

service "httpd" do
        action [:enable, :start]
end

当我在节点中运行chef-client时,它返回以下错误:

Error executing action `start` on resource 'service[httpd]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '1'
    ---- Begin output of /sbin/service httpd start ----
    STDOUT: Starting httpd: [FAILED]
    STDERR: Syntax error on line 15 of /etc/httpd/conf.d/stedelahunty2.conf:
    order takes one argument, 'allow,deny', 'deny,allow', or 'mutual-failure'
    ---- End output of /sbin/service httpd start ----
    Ran /sbin/service httpd start returned 1

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/apache/recipes/default.rb

     35: service "httpd" do
     36:    action [:enable, :start]
     37: end

    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/apache/recipes/default.rb:35:in `from_file'

    service("httpd") do
      action [:enable, :start]
      supports {:restart=>false, :reload=>false, :status=>true}
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      service_name "httpd"
      enabled true
      pattern "httpd"
      declared_type :service
      cookbook_name "apache"
      recipe_name "default"
    end

我尝试将其重命名为apache,将选项更改为':restart',完全注释掉,但这意味着httpd无法启动。在厨师运行完成后,我只需要一种简单的方法来重启服务。

再次,为新手问题道歉;我对编码很新。

干杯

1 个答案:

答案 0 :(得分:1)

这不是厨师问题。 Apache httpd报告

  

/etc/httpd/conf.d/stedelahunty2.conf第15行的语法错误:order接受一个参数,' allow,deny',' deny,allow',或者'互惠故障'