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
issuehttps://github.com/jkeiser/knife-essentials/issues/67 for
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.
Thanks!
--John
On Mon, Aug 20, 2012 at 8:24 AM, Denis Haskin denis@constantorbit.comwrote:
When I use knife diff from the knife-essentials[1] 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) [2]. 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?
Thanks!
[1] GitHub - jkeiser/knife-essentials: Knife commands to treat the Chef server like a filesystem
[2] (portion of output of knife diff --name-status)
D environments/obanyc_testrl.json
D environments/obanyc_prod.json
D environments/obanyc_dev.json
D environments/obanyc_demo.json
D environments/_default.json
D environments/obanyc_replay.json
D environments/staging.json
D environments/obanyc_qa.json
D environments/obanyc_staging.json
D roles/queuep.json
D roles/app.json
D roles/1ie.json
D roles/tds.json
D roles/2ie.json
D roles/queues.json
...etc for all roles...
--
Denis Haskin
cell: 781-258-7414