- From: Sean OMeara <
>
- To:
- Subject: [chef] Re: How to enhance an existing provider?
- Date: Tue, 1 Jan 2013 17:46:08 -0500
Hi!
Excellent question. The best way to do this is to use a cookbook to
monkey patch the Chef::Provider::File class, so you can experiment
with it without having to modify core Chef.
As it turns out, I started making a pass at this very issue a few
years ago, but never got around to finishing it.
Here's a good place to start!
https://github.com/someara/cookbook-selinux/tree/monkeys
Let me know if you have any questions or need any assistance.
-s
On Tue, Jan 1, 2013 at 5:26 PM,
<
>
wrote:
>
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.