[chef] Re: Re: rerunnable and idempotent?


Chronological Thread 
  • From: Mike Bailey < >
  • To:
  • Subject: [chef] Re: Re: rerunnable and idempotent?
  • Date: Sun, 4 Apr 2010 20:44:53 +1000
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=ABf5CQfbSWsSo6cGkl+a+jDXxbjjzidKfqoRxycdSDv3Ti5z8XP2PnRey7krdFp/W2 5/Vw2YlP6htr1b8pUQGd2u7tnUpVfkFO4/oq2N4ggZjQ8g5UWJfNDvlEZZstRnUTZgm7 iAr7z29uOdgbm91XNzyK1lnOSWYMGLBhWCTUY=

I'm glad to hear that the intention is for recipes to be idempotent and re-runnable.

Deprec had a similar issue with nginx's start script. For that case I chose to ignore the return code although a better solution might be to check the service status.

- Mike

On Sun, Apr 4, 2010 at 2:49 AM, Adam Jacob < "> > wrote:
This is a question of what the return code from rabbitmq-server is - in this case, the rabbitmq-server start command returns a non-zero status code, which we (by neccesity) treat as an error.

We can (and will) change the resource so that this is worked around, but the real bug is in the rabbitmq-server init script.

Adam

Sent from my iPhone
Re-running bootstrap::server fails if rabbitmq-server was already started by previous installation.

Should we expect chef recipes to be re-runnable and idempotent? I would suggest a call to start a service should not error out if the service is already running.

thanks,

Mike 

:~# cat solo.rb 
file_cache_path "/tmp/chef-solo"
cookbook_path "/tmp/chef-solo/cookbooks"
:~# cat chef.json 
{
  "bootstrap": {
    "chef": {
      "url_type": "http",
      "init_style": "runit",
      "path": "/srv/chef",
      "serve_path": "/srv/chef",
      "server_fqdn": "chef.failmode.com",
      "webui_enabled": true
    }
  },
  "run_list": [ "recipe[bootstrap::server]" ]

:~# chef-solo -c ~/solo.rb -j ~/chef.json
[Sat, 03 Apr 2010 14:30:50 +0000] INFO: Starting Chef Solo Run
[Sat, 03 Apr 2010 14:31:12 +0000] ERROR: service[rabbitmq-server] (/tmp/chef-solo/cookbooks/rabbitmq_chef/recipes/default.rb line 45) had an error:
/etc/init.d/rabbitmq-server start returned 1, expected 0
/usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/mixin/command.rb:179:in `handle_command_failures'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/mixin/command.rb:122:in `run_command'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/provider/service/init.rb:37:in `start_service'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/provider/service.rb:62:in `action_start'







Archive powered by MHonArc 2.6.16.

§