Why can't “knife data bag from file” find existing json file on chef server?

Posted by ellisera on Server Fault See other posts from Server Fault or by ellisera
Published on 2012-10-17T21:57:40Z Indexed on 2012/10/17 23:03 UTC
Read the original article Hit count: 660

Summary:

I'm running into a problem with "knife data bag from file", where knife doesn't recognize the .json data bag file pulled down from a remote git repo.

Background:

I'm currently trying to transition from chef-solo use to chef server while using the cookbooks, data bags and other chef info from our remote git repo.

I've currently pulled down a copy of our git repo and set the cookbook path and data bag path in knife.rb. I also loaded the cookbooks, made adjustments, etc.

Details:

When trying to load our .json data bags by doing "knife data bag add from file FOLDER FILE" it looks like it worked until I do "knife data bag list" and it comes up blank. So I decided to try adding the edit option at the end to see what's being loaded, if it is. This is the error I get:

knife data bag from file local_settings test.json -e nano
ERROR: Could not find or open file 'test.json' in current directory or in 'data_bags/local_settings/test.json'

The data bag file does exist, in the proper location, in a tested, working json file. I've also sometimes gotten an error saying "could not open data bag "local_settings".

I would obviously like to keep the data bag path within the appropriate git repo folder to be able to keep track of changes in a more centralized location (our git repo, as opposed to the chef server).

Any solutions, advice or pointers in the right direction are appreciated.

© Server Fault or respective owner

Related posts about amazon-ec2

Related posts about automation