It was bound to happen somewhen

Over the last few months we have gradually been building up a chef installation alongside our puppet configuration, Totally insane you may think; well it is. In our team I am pretty good with Puppet, Tom is pretty good with Chef so the only way to come up with a good solution is to use both and evaluate, that is where we are. So currently we are using puppet for all of our application based configuration and chef for our Infrastructure, and over the last few months I’ve poked it a couple of times but not too much, well today I’ve been poking it a lot more and doing stuff of use.

So I have to learn how to use Chef else I can’t decided between the two, so far so good. It has some issues but nothing major or nothing that’s bitten me yet. I should probably clarify that we run both our puppet and chef distributed so we can’t make use of the more powerful / useful server side, either way it’s handy.

Things I like so far

One of the things I like about chef instantly is the fact it is just ruby, it sounds silly but it means I can do things like …

node["rssh"]["chroot_files"].each do |link|
  link "#{node["rssh"]["chroot_jail"]}#{link}" do
    to "#{link}"
    link_type :hard
  end
end

Now in puppet, you would have to create a define and call the define with an array of “names” to do the same thing, but the chef code is more readable, especially as I do know some ruby.

In addition to this, inside Cookbooks you have an attributes directory, which s exactly what I try and do within puppet with my params stuff, Here but because it’s a well known structure it’s used more, this does mean that people can write cookbooks in a standard-ish way or at least it seems that way it is also a lot easier to maintain in this way.

Things I don’t like

At the moment i’m not too sure about having to have a recipes directory and then everything in that one place, some times the cookbooks I write may have many recipes and they look messy having so many on one directory. I don’t know if you can put them in folders but it doesn’t look like it, at least in puppet it will recursively go through folders to load the files.

Error messages, Chef’s are seemingly pointless, it may as well say Error in file at line. There is basically almost no interpretation of the actual error, but lots of information as bellow.

[2012-11-14T16:39:05+00:00] INFO: Processing template[/etc/rssh.conf] action create (rssh::default line 14)

================================================================================

Error executing action `create` on resource 'template[/etc/rssh.conf]'

================================================================================


Chef::Mixin::Template::TemplateError
------------------------------------
undefined local variable or method `nodes' for #<Erubis::Context:0x0000000458f9b8 @node=node[localhost]>

Resource Declaration:
---------------------
# In /tmp/vagrant-chef-1/chef-solo-2/cookbooks/rssh/recipes/default.rb

 14: template "/etc/rssh.conf" do
 15:   source "rssh.conf.erb"
 16:   owner  "root"
 17:   group  "root"
 18:   mode   0644
 19: end
 20: 

For those confused it’s line 12 with the actual error, and that is only half the message so it’s easy to miss one line out of the 40 odd.

Now to be fair, puppet’s errors are sometimes stupid and typically not enough information to actually be useful, but they are mostly straight forward, these errors are not as clear, but they at least do have some more value. I guess the real failing here is me not understanding how to interpret the error messages, either way it was a little annoying.

Summary

All in all, I quite like it, i’ve not seen anything in my limited play with it to say it’s going to be impossible to use and it has some nice features. Hopefully over the next few months I’ll sart using it a bit more so I can understand which one is best for us to use longer term, or we keep them both, and develop a nice hybrid solution… hopefully with clearly defined boundaries :)

Category:
Linux
Tags:

Join the conversation! 3 Comments

  1. […] week I was starting to Play with chef and as part of that I was convinced by Tom (one of our Sysadmins) to stop building servers in […]

    Reply
  2. So I think you have missed many things in the error message/stacktrace above.
    Line 1 tells you where the error has occurred. The default recipe in the rssh cookbook, line 14.
    Line 5 tells you further that there was trouble creating the rssh.conf file
    Line 10 shows it is a template error and
    Line 12 shows you the error output from Erubis, the ruby templating engine.
    Lines 16+ then conveniently show you the lines in the recipe that are causing you issue.

    It takes some time to understand the fullness of Chef error messages, but geenerally they are very verbose and useful.

    Reply
    • The more I play with Chef the mor I find my self liking the logs, Granted it’s not as concise as some puppet errors but they are all equally detailed; something puppet fails to do. With puppet it can sometimes produce some really obscure errors that mean nothing look at this: http://bitcube.co.uk/content/puppet-errors-explained They can some times be very misleading where as the impression I have of chef so far is they are nothing but consistent, granted sometimes they are just a wall of text and when you’re newer to it, it is a bit daunting. It is actually becoming easier (with your help!) to understand some of the quirks, All I need to do now is learn not to keep hacking it until it works and write some proper recipes :D

      Reply

Don't be Shy, Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: