Hi Denis. Glad you like the tool!
It’s option (a): Chef takes the .rb files and turns them into JSON before
we send them. But a brief note: the Chef server is just a REST interface
(which admittedly uses the JSON format) and is not actually a filesystem.
knife-essentials imposes that structure: it maps the server’s REST
interface into a virtual filesystem composed of .json files (i.e. the
environments/blah.json “file” corresponds to HTTP GET/PUT/DELETE operations
on /environments/blah). It turns out this gives us a powerful toolset, and
is a super convenient way to think about the system, but just FYI, that’s
an invention of knife-essentials.
The issue you are seeing is that knife diff assumes that your local
filesystem looks the same as the virtual mapping (it assumes a certain
directory structure, and assumes that files are .json). For many people
this is true, but not everyone (i.e. .rb files). I’ve filed an
its lack of .rb support, because I still need to weigh the complexity costs
of supporting multiple file formats against the benefits of .rb files.
Solution: If you’re OK with JSON instead of RB files, the simplest
solution is to:
- Run “knife download roles environments”, which will download all your
current environments and roles as .json files.
- Verify that the .json files actually represent when you wrote in the .rb
files, and delete the .rb files to get rid of confusion.
I’d love to hear whether this solution works for you.
On Mon, Aug 20, 2012 at 8:24 AM, Denis Haskin email@example.com:
When I use knife diff from the knife-essentials gem (which is awesome,
by the way), it shows me a lot of JSON files in the environments/ and
roles/ folders that don’t exist in my local filesystem (e.g. only on the
chef server) . But I have corresponding .rb files for each .json file
that is indicated as “missing”.
This is confusing… either (a) chef creates the .json files when I upload
environments or roles to the server, from the .rb files, or (b) these are
left over on the server from an old version of chef.
Anybody know which it is? Is there some way I can fix this?
 (portion of output of knife diff --name-status)
…etc for all roles…