- From: John Vincent <
>
- To: KC Braunschweig <
>
- Cc: Chef Dev <
>
- Subject: [chef-dev] Re: need help fixing CHEF-2345 unable to override supports :status for redhat services
- Date: Thu, 7 Jun 2012 08:16:20 -0400
Would an ||= work in that case? I've not dug into the providers in
quite some time.
On Thu, Jun 7, 2012 at 7:26 AM, KC Braunschweig
<
>
wrote:
>
Hoping you guys can help me as I couldn't quite come up with a fix for
>
this bug. I think the desired feature was that :status should default
>
to true for Redhat rather than false with other providers, but because
>
lib/chef/provider/service/redhat.rb does:
>
>
@new_resource.supports[:status] = true
>
>
The effect is that :status always = true and you can't set it to false
>
such as if you have a misbehaving 3rd party init script you can't fix.
>
This is lame. Problem is that the defaults come from the resource code
>
not the provider so I think that the way to fix this is in
>
lib/chef/resource/service.rb when the defaults are set:
>
>
@supports = { :restart => false, :reload => false, :status => false }
>
>
But to do this I need to inspect the provider to know if we're on
>
redhat, something like:
>
>
if provider == 'Chef::Provider::Service::Redhat'
>
>
= { :restart => false, :reload => false, :status => true }
>
else
>
>
= { :restart => false, :reload => false, :status => false }
>
end
>
>
But provider is nil at that point. Tried calling straight to
>
Chef::Platform.provider_for_resource(self) but that doesn't work
>
either because the run_context isn't set at that point.
>
>
Anyone got another angle or a way to make this work?
>
>
Thanks,
>
>
KC
Archive powered by MHonArc 2.6.16.