【问题标题】:Chef Error executing action `start` on resource 'service[httpd]'在资源“服务 [httpd]”上执行操作“开始”时出现厨师错误
【发布时间】:2015-04-11 10:16:48
【问题描述】:

这是我非常基本的食谱/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 无法启动。在厨师运行完成后,我只需要一种简单的方法来重新启动服务。

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

干杯

【问题讨论】:

    标签: ruby apache centos chef-infra chef-recipe


    【解决方案1】:

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

    /etc/httpd/conf.d/stedelahunty2.conf 的第 15 行出现语法错误:order 采用一个参数,“allow,deny”、“deny,allow”或“mutual-failure”

    【讨论】:

    • 啊,好吧,既然它将是一个基本的 apache 服务器,我应该保留哪些选项?
    • 对不起,我不知道。你想达到什么目的以及食谱中的vhost.erb 是如何实现的。 /etc/httpd/conf.d/stedelahunty2.conf节点上的样子?
    • 我从另一个示例复制并粘贴到我的食谱中,它似乎有效。不幸的是,这并没有让我知道在未来修复我的解决方案,但它现在正在工作。感谢您尝试提供帮助。谢谢
    • 我可以从错误消息中了解到,提供给 Order 指令的参数无效。您至少可以阅读文档以了解它在做什么。我不能说,如果 Order 在您之前生成的模板中包含零个或多个参数。
    • 正如斯蒂芬金所说,这是一个 apache 问题,而不是厨师问题。也许将您的 stedelahunty2.conf 文件发布在一个新问题中,并用 apache 标记该问题,看看 apache 人员是否可以帮助您了解它为什么不好。如果您发布 .erb 文件,我们或许可以帮助您了解为什么您的价值不高。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-22
    相关资源
    最近更新 更多