Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"FATAL: Cannot load configuration" after chef-client

Tags:

chef-infra

I'm running the following command:

chef-client --local-mode -j deploy-backend.json

JSON file contains:

{
  "run-list" : [
    "deploy-dev::sysprepare",
    "deploy-dev::deploybackend",
    "deploy-dev::deploynginx"
  ]
}

Now the problem: chef-client command runs succesfully but gives a FATAL error at the end, after running the recipes:

$ sudo chef-client --local-mode -j cookbooks/deploy-backend.json 
[2017-07-13T13:19:11+02:00] WARN: No config file found or specified on command line, using command line options.
Starting Chef Client, version 13.2.20
resolving cookbooks for run list: ["deploy-dev::sysprepare", "deploy-dev::deploybackend", "deploy-dev::deploynginx"]
Synchronizing Cookbooks:
  - deploy-dev (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 29 resources
Recipe: deploy-dev::sysprepare
...
...
- reload service service[nginx]

Running handlers:
Running handlers complete
Chef Client finished, 11/33 resources updated in 01 minutes 32 seconds
[2017-07-13T13:20:43+02:00] WARN: No config file found or specified on command line, using command line options.
[2017-07-13T13:20:43+02:00] WARN: No config file found or specified on command line, using command line options.
[2017-07-13T13:20:43+02:00] FATAL: Cannot load configuration from cookbooks/deploy-backend.json
[2017-07-13T13:20:43+02:00] FATAL: Cannot load configuration from cookbooks/deploy-backend.json

I've omitted most of the output, "reload service service[nginx]" is the last resource in the runlist. I've manually verified that the recipes run correctly, but i'm getting that FATAL error at the end (this is called from a CI job, so my CI pipeline is failing because of this).

This is strange, as the execution of the recipes went ok. I'm using chef-client version 13.2.20. If i use version 12 of chef-client this executes ok. Also if i just pass the runlist:

chef-client --local-mode -r "deploy-dev::sysprepare,deploy-dev::deploybackend,deploy-dev::deploynginx"

It executes correctly. Does anybody know what's going on here?

like image 323
roirodriguez Avatar asked Jul 13 '17 11:07

roirodriguez


1 Answers

you should use full path to your json

sudo chef-client --local-mode -j /opt/chef/cookbooks/deploy-backend.json 
like image 56
Антон Каминский Avatar answered Sep 29 '22 10:09

Антон Каминский