Lwrp presentation

Jul. 18, 2012
Lwrp presentation
Lwrp presentation
Lwrp presentation
Lwrp presentation
Lwrp presentation
Lwrp presentation
Lwrp presentation
Lwrp presentation
Lwrp presentation
Lwrp presentation
Lwrp presentation
Lwrp presentation
Lwrp presentation
Lwrp presentation
Lwrp presentation
Lwrp presentation
1 of 16

More Related Content

Similar to Lwrp presentation

Chef Fundamentals Training Series Module 1: Overview of ChefChef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of ChefChef Software, Inc.
Chef, Vagrant and FriendsChef, Vagrant and Friends
Chef, Vagrant and FriendsBen McRae
Introduction to Cooking with ChefIntroduction to Cooking with Chef
Introduction to Cooking with ChefJohn Osborne
Resources, Providers, and Helpers Oh My!Resources, Providers, and Helpers Oh My!
Resources, Providers, and Helpers Oh My!Brian Stajkowski
Managing Distributed Systems with ChefManaging Distributed Systems with Chef
Managing Distributed Systems with ChefMandi Walls
2015 08-11-scdo-meetup2015 08-11-scdo-meetup
2015 08-11-scdo-meetupSuresh Paulraj

Recently uploaded

Cloud Composer workshop at Airflow Summit 2023.pdfCloud Composer workshop at Airflow Summit 2023.pdf
Cloud Composer workshop at Airflow Summit 2023.pdfLeah Cole
Uber Clone Script - Keys to Understanding the Ride Hailing IndustryUber Clone Script - Keys to Understanding the Ride Hailing Industry
Uber Clone Script - Keys to Understanding the Ride Hailing IndustryeSiteWorld TechnoLabs Pvt. Ltd.
"Stateful app as an efficient way to build dispatching for riders and drivers..."Stateful app as an efficient way to build dispatching for riders and drivers...
"Stateful app as an efficient way to build dispatching for riders and drivers...Fwdays
Knowledge Graphs and Generative AI_GraphSummit Minneapolis Sept 20.pptxKnowledge Graphs and Generative AI_GraphSummit Minneapolis Sept 20.pptx
Knowledge Graphs and Generative AI_GraphSummit Minneapolis Sept 20.pptxNeo4j
Google cloud Study Jam 2023.pptxGoogle cloud Study Jam 2023.pptx
Google cloud Study Jam 2023.pptxGDSCNiT
Unleashing Innovation: IoT Project with MicroPythonUnleashing Innovation: IoT Project with MicroPython
Unleashing Innovation: IoT Project with MicroPythonVubon Roy

Lwrp presentation

Editor's Notes

  1. Lets first talk about resources and providers in general (and their ‘non light weight’ implementations)\nResources are a great way to abstract repeatable patterns\nShorcuts I may say => ivar = instance variable, DSL = domain specific language, \n
  2. RunContext order -> Libraries, Providers, Resources, Attributes, Definitions, Recipes\nArgument after resource name is called the “Name attribute”\n\n\n
  3. chef-0.10.10/lib/chef/resource/directory.rb\nRegular ruby class\nresource attributes are methods\nPath is the “name” attribute\n
  4. Chef::Platform contains a HASH of default providers based on operating systems\n\n
  5. All resource actions are named action_<action name>\nload_current_resource is responsible for determining the current state of the resource (where we are)\nnew resource is the state we want the resource in (where we want to be)\nRegular ruby class (This one inherits from Chef::Provider::File)\n\n
  6. \n
  7. \n
  8. name_attribute is populated by the name given when the resource is called\ndefault_action is chef 0.10.10 and above (Will show you later how to do 0.10.8 and below)\nall resources get the :nothing action\nTwo parameters for “attribute” Name of the attribute and the validation parameters\n\n\n
  9. Resource parameters (attributes) are not to be confused with node attributes!\nprovider Chef::Provider::Cookbookname::Providername or provider :my_other_provider\nList of validation parameters\n\n\n\n
  10. You can use other chef resources inside of your providers\nYou can access data passed into the resource via new_resource.<attribute name>\nAll resource actions are implemented here!\nOnly one method for this DSL -> action\n\n
  11. \n
  12. Could also use: \nmyvar = Chef::ShellOut.new(“Some Command”)\nmyvar.run_command (runs the command)\nmyvar.stdout (the output)\n
  13. \n
  14. the run_context is only needed for the case of wanting to use methods like #user, #mount, #cookbook_file\nthe sub_run_context is a subset of resource executed in the provider (since you initialize its ResourceCollection)\nany? Passes the updated function to the set of resources, returns functions that respond with anything other than (nil,false)\nrun_context loads and tracks the context of a chef run\nconverge: iterates over the resource_collection in the run_context calling run_action for each resource\n
  15. \n
  16. \n