Skip to content

Instantly share code, notes, and snippets.

@ranjib
Last active December 18, 2015 04:28
Show Gist options
  • Save ranjib/5725116 to your computer and use it in GitHub Desktop.
Save ranjib/5725116 to your computer and use it in GitHub Desktop.
Topics that we can discuss on chef internal

Topics

  1. Mixlib-shell out interface :: A portable , cross platform command execution module. How to use it with any arbitrary code, how chef interfaces with it (shellout, shellout! etc)

  2. Mixlib-Cli :: The awesome command line argument processor. How to use it with any arbitrary program , pitfalls associated with reusing classes that uses mixlib-cli

  3. A generic overview of the chef rest class (Chef::Rest) and main domain objects (Node, Role, ApiClient etc). How to access them from any arbitrary scripts (#load, #list . #search etc).

  4. Anatomy of a chef run (revisited with chef internal) :

    1. setup phase (logging setup, configuration setups, client registration, getting a node's runlist)
    2. cookbook syncing,
    3. building the node (running ohai, merging the attributes obtained from cookbooks)
    4. compile phase .. (building the extended run list, .. resource_collection)
    5. execution phase .. notifications resolution
    6. handlers execution (report/exception) & optional node.save
  5. Digging deep inside a run context: what it holds, which all chef core components (e.g runner, provider etc) needs run context to function

  6. Digging deep inside a provider (we can talk about resource, but theres not moch).

  7. the notion of convergence, how why_run works, how to make a custom resource (may be lwrp) why_run compatible

  8. how the action_* works

  9. Knife plugin development

  10. how to write knife plugins that can be reused by other knife plugins? what are the pitfalls (Mixlib::Config gotchas). What to avoid, & other tricks (like dep loading, config settings etc).

  11. using ui object for messages, warning etc

  12. using ui.output & automagically support -Fj

  13. The events api: Chef has an awesome events api . it provides event hooks/callbacks to a wide set of states (like cookbook sync begin., chef run starts etc). A brief overview of what all events available and a small example on how to hook your logic against a particular event.

  14. Formatters. The formatter api , writing a custom formatter .

  15. Ohai .. extending ohai, pitfalls, apis etc.

  16. A brief overview of Mash , ChefFS, Mixlib::JSONCompat . Why these modules are used inside chef , instead of vanilla ruby alternatives? And why someone extending chef should use these components

  17. Debugging chef

  18. chef applications (chef-client, chef-solo etc) and -l debug option

  19. knife plugins and increasing verbosity (-VV)

  20. chef-shell

  21. using pry to debug chef run.

  22. rbtrace with chef

Code examples

  1. Configure chef from irb and run a search
  2. Enlist all the nodes
  3. Get a particular node and save an attribute in it.
  4. Use mixlib-shellout to tail a log and stream its output
  5. Manually create a run context , assign an individual package resource and invoke a chef run.
  6. Hook a custom call back against chef run start event
@miah
Copy link

miah commented Jun 6, 2013

I created an org to handle this stuff just after Chefconf. I just invited you to it. I think this list looks great. Would you be up for a hangout to discuss in more detail in the next few days?

@danielsdeleo
Copy link

Probably need John Keiser to talk about ChefFS, I'm totally ignorant of how it works. But also note that it's not an alternative to File and friends, it's a thing that provides file/path type semantics on top of a chef repo or chef server.

@ranjib
Copy link
Author

ranjib commented Jun 7, 2013

@miah sure .. let me know the timings
@danielsdeleo yeah the reason i included ChefFS , is we do lot of path manipulation (with relative paths) in context of data bag, cookbook and other chef domain objects. ChefFS provide a neat interface to handle those, like if someone wants create Chef object straight from filesystem, ChefFS has some api for those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment