DevOps Zone is brought to you in partnership with:

Mark is a graph advocate and field engineer for Neo Technology, the company behind the Neo4j graph database. As a field engineer, Mark helps customers embrace graph data and Neo4j building sophisticated solutions to challenging data problems. When he's not with customers Mark is a developer on Neo4j and writes his experiences of being a graphista on a popular blog at http://markhneedham.com/blog. He tweets at @markhneedham. Mark is a DZone MVB and is not an employee of DZone and has posted 553 posts at DZone. You can read more from them at their website. View Full User Profile

Chef, Fedora and ‘ArgumentError: Attribute domain is not defined!’

11.11.2011
| 4266 views |
  • submit to reddit

I’ve been playing around with Chef Solo on Fedora and executing the following:

sudo chef-solo -c config/solo.rb -j config/node.json

(where node.json just contains the example code from the resolver example on the Chef documentation page and the cookbooks folder contains all the opscode cookbooks.)

leads to the following error:

...
ERROR: Running exception handlers
ERROR: Exception handlers complete
FATAL: Stacktrace dumped to /home/mark/chef-solo/chef-stacktrace.out
FATAL: ArgumentError: Attribute domain is not defined!

A bit of googling led me to believe that this error is happening because the machine doesn’t have a fully qualified domain name (fqdn) defined which can be seen by calling the following command:

$ hostname -f
> hostname: Name of service not known

One way to fix it is to add the following entry to /etc/hosts

127.0.0.1	mark-fedora

Which results in the script running fine with no errors.

...
INFO: Running report handlers
INFO: Report handlers complete

A suggestion I read while googling about fqdn was to add the hostname of the machine into a file called /etc/HOSTNAME but that didn’t seem to have any impact for me.

On the Mac hostname -f works fine even without an entry like the above in /etc/hosts so I’m not entirely sure how it all works!

If anyone could explain it to me that’d be awesome.

Source: http://www.markhneedham.com/blog/2011/06/18/chef-fedora-and-argumenterror-attribute-domain-is-not-defined/

Published at DZone with permission of Mark Needham, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)