Search code examples
chef-infracookbooklwrp

Where yum_repository resource is defined?


Probably this would be an easier one for the experts.

I’m learning to write custom LWRP and hence trying to understand the one that is already written.. the yum cookbook. It can be found here: http://community.opscode.com/cookbooks/yum

Question: In above cookbook, where (which file/line) is the resource yum_repository is defined?

I had gone through every single line of this cookbook and ran various combinations of grep searching for this string, but nothing helped.

Could you help me understand where and how the yum_reposiroty resource is defined/coded in above cookbook.

Thanks.

UPDATE:

I think I should have been more clear. I am trying to understand what makes yum_repository a valid resource name whereas yum_spiderman is not a valid resource name. In other words, the keyword yum_repository MUST have been defined somewhere in the cookbook. I know that there is a resource n provider named repository. However, my question is about yum_repository (NOTE: I want to know where does the yum_ part in the resource name figure in ). OR may be my interpretation is wrong but the question remains the same.


Solution

  • A LWRP consists of two files, a "resource" (declaration) and "provider" (implementation):

    1. https://github.com/chef-cookbooks/yum/blob/master/resources/repository.rb
    2. https://github.com/chef-cookbooks/yum/blob/master/providers/repository.rb