0

Chef を使用してローカル仮想ホストを作成しようとしています。そのために、ランリストに「recipe [apache2]」レシピを追加しました。デフォルトの apache2 レシピを含むランリストに別のレシピも追加するまではうまくいきました。ここで、新しいレシピをランリスト アクション 'start' から削除しても、次のエラーで失敗します。これは何が原因か分かる人いますか?

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


Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /etc/init.d/apache2 start ----
STDOUT: * Starting web server apache2
Action 'start' failed.
The Apache error log may have more information.
   ...fail!
STDERR: Syntax error on line 2 of /etc/apache2/sites-enabled/example.conf:
ServerName takes one argument, The hostname and port of the server
---- End output of /etc/init.d/apache2 start ----
Ran /etc/init.d/apache2 start returned 1


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

210: service 'apache2' do
211:   action :start
212: end



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

service("apache2") do
  action [:start]
  supports {:restart=>true, :reload=>true, :status=>true}
  retries 0
  retry_delay 2
  service_name "apache2"
  pattern "apache2"
  restart_command "/usr/sbin/invoke-rc.d apache2 restart && sleep 1"
  reload_command "/usr/sbin/invoke-rc.d apache2 reload && sleep 1"
  cookbook_name "apache2"
  recipe_name "default"
end



[2014-03-04T17:52:20+00:00] INFO: Running queued delayed notifications before         re-raising exception
[2014-03-04T17:52:20+00:00] ERROR: Running exception handlers
[2014-03-04T17:52:20+00:00] ERROR: Exception handlers complete
[2014-03-04T17:52:20+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2014-03-04T17:52:20+00:00] INFO: Sending resource update report (run-id: 3d91fc5b-cf02-4788-bb56-f03ebe274702)
[2014-03-04T17:52:21+00:00] ERROR: service[apache2] (apache2::default line 210) had an  error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /etc/init.d/apache2 start ----
STDOUT: * Starting web server apache2
Action 'start' failed.
The Apache error log may have more information.
   ...fail!
STDERR: Syntax error on line 2 of /etc/apache2/sites-enabled/example.conf:
ServerName takes one argument, The hostname and port of the server
---- End output of /etc/init.d/apache2 start ----
Ran /etc/init.d/apache2 start returned 1
[2014-03-04T17:52:21+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
4

1 に答える 1

1

見てください/etc/apache2/sites-enabled/example.conf:出力は言う

ServerName は 1 つの引数を取ります。サーバーのホスト名とポートです。

明らかに、あなたはsever_name属性を渡していません - READMEと used templateを見てください:

web_app "my_site" do
  server_name node['hostname']
  server_aliases [node['fqdn'], "my-site.example.com"]
  docroot "/srv/www/my_site"
end

これで問題が解決しない場合は、投稿を編集して、サンプルサイトの定義方法のコードを追加してください。

于 2014-03-04T19:46:39.310 に答える