Skip to content
This repository

Every run returns 'Could not finish configuring the node' #87

Closed
markbirbeck opened this Issue · 3 comments

2 participants

Mark Birbeck Miquel Torres
Mark Birbeck

Every time I use fix I get a failure message:

FAILED: chef-solo could not finish configuring the node

I was about to give up on LittleChef when I noticed that the actual messages logged to the console implied that the configuration had been successful:

.
.
.
[Wed, 14 Mar 2012 10:31:04 +0000] INFO: Chef Run complete in 1.217859 seconds
[Wed, 14 Mar 2012 10:31:04 +0000] INFO: Running report handlers
[Wed, 14 Mar 2012 10:31:04 +0000] INFO: Report handlers complete

It turns out that at the beginning of the output is a message saying that the log directory couldn't be written to:

Cooking...
tee: /var/log/chef/solo.log: No such file or directory

and that is the reason that a failure is being recorded -- there is no directory /var/log/chef on a fresh machine (at least not on a machine created using knife).

The path is set in littlechef.LOGFILE and one workaround would to change it to something like /var/log/chef-solo.log. Another workaround is to ensure that the directory is created in solo.py. In the imports section add:

from littlechef import LOGFILE as logging_path

and then at the point where the /etc/chef directory is created, add a couple of lines to create the directory:

 # Set up chef solo configuration
+if not exists(logging_path):
+    sudo('mkdir -p {}'.format(logging_path))
 if not exists('/etc/chef'):
     sudo('mkdir -p /etc/chef')
Mark Birbeck markbirbeck referenced this issue from a commit in sidewinderlabs/littlechef
Mark Birbeck markbirbeck [#87] Create log directory if it doesn't exist. 03abd07
Miquel Torres
Owner

What distro are you using? and you installed chef by using knife. Does that always mean it is a gem install?

Usually, Chef debian packages create /var/log/chef/, which is why LittleChef never bothered to create it itself.
You probably found a distro/installation method combination that doesn't create the folder.

Mark Birbeck

I'm using knife to manage the cookbooks so I thought I might as well use knife to launch the EC2 instances. I don't know if they do anything out of the ordinary when they bootstrap.

The command I use is:

knife ec2 server create \
  --groups=default \
  --region=eu-west-1 --availability-zone=eu-west-1a \
  --image=ami-895069fd --flavor=m1.medium \
  --ssh-user=ubuntu --ssh-key={AWS key} --identity-file=~/.ssh/{local key}.pem

The AMI is Ubuntu 11.10.

Miquel Torres
Owner

I think when bootstrapping they install Chef by using gems. I can imagine that gem install doesn't create the directory, but I would have assumed that after the first chef run it would be.

Miquel Torres tobami closed this
Ben Dyer bendyer referenced this issue from a commit in taguchimail/littlechef
Mark Birbeck markbirbeck [#87] Create log directory if it doesn't exist. 8d739d7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.