[chef] How to enhance an existing provider?


Chronological Thread 
  • From:
  • To: < >
  • Subject: [chef] How to enhance an existing provider?
  • Date: Tue, 1 Jan 2013 14:26:15 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=sendgrid.info; h=subject :from:to:mime-version:content-type:sender; q=dns; s=smtpapi; b=u sSWkvIh5ZGFg+3u1JejOE6IctOhFicARMmzJabV3bB3cDIPINNWbJov2vZgkz1Fd zBdRAWrUGLJcluFeFV89Y+GfrMOqRnRETJwmrhWcpi/26QW6eJtU9dx1TDUOgBZi lffUziPh+v07QxfYHiGMaqX/PYhxtfQ1Dm3vRz77bs=

I’m still on the up-slope of my Chef learning curve…

 

What I’d like to do is enhance the Chef::Provider::File. It seems to me that the documentation section “Extending an existing provider” would apply here, but I don’t fully understand how it would work. I would create a mixin and put it into the library directory – and then what?  How would all my cookbooks – and the community ones I’m using - know to use this mixin?

 

 

Specifically, what I’m trying to accomplish is fix one of the major annoyances in Chef; it not only doesn’t support SELinux, but actively clobbers the SELinux context for all he files, templates etc. that it creates. So my recipes are littered with execute resources for the “restorecon” utility to reset this everwhere I use a file-related resource (templates, remote_file, cookbook file etc.). It is becoming unmanageable, especially with community cookbooks that of course don’t have my hack added.

 

Conceptually the fix is simple: in the file provider, in addition to setting the file permissions, I would also need to call restorecon.

 

Rather than hacking the File resource itself, I would like to put this feature into my SELinux cookbook, and have that somehow add a Mixin to the File resource.

 

I just can’t figure out how to do that.

 

Thanks!

 




Archive powered by MHonArc 2.6.16.

§