Opscode Chef notes

Mostly for my benefit.

I was getting this error on a server:

FATAL: NoMethodError: private method `gsub' called for nil:NilClass

Turned out I didn’t have my hostname set.

# hostname -f
hostname: Unknown host

After setting my hostname the error went away.


I wanted to set some attributes in a role that could be used by a bunch of recipes.

This is the syntax I used.

:ganglia_server => "ganglia.example.com",
:serveradmin => "david@example.com"

Then in a template I used.


 owner = "<%= node.serveradmin %>"
 host = "<%= node.ganglia_server %>"

Maybe is should have been obvious to do it this way. But for me it wasn’t.



Filed under Uncategorized

2 responses to “Opscode Chef notes

  1. FATAL: NoMethodError: undefined method `include?’ for nil:NilClass

    hostname was set but no DNS entry.

    Adding /etc/hosts file entry made the error go away.

  2. Or like this:

    override_attributes “mysql” => { “server_root_password” => “root”,
    “key_buffer” => “16M” }

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