Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Move the forwarder_monitor validation to the provider? #91

Open
gravesb opened this issue Sep 11, 2015 · 0 comments
Open

Move the forwarder_monitor validation to the provider? #91

gravesb opened this issue Sep 11, 2015 · 0 comments

Comments

@gravesb
Copy link
Contributor

gravesb commented Sep 11, 2015

I have a use case where I have a cookbook that optionally includes splunk integration. It looks something like:

  cerner_splunk_forwarder_monitors foo do
    action :install
    ...
    only_if { enable_splunk }
  end

However, even if that enable_splunk attribute is set to false it still fails during the compilation phase if node['splunk']['home'] is not defined. The only_if clause is evaluated later on during the execution phase. I could modify that cookbook to do this:

if enable_splunk
  cerner_splunk_forwarder_monitors foo do
    action :install
    ...
  end
end

but then foodcritic flags that as lint. Thoughts on moving that validation into the provider instead of doing it in the after_created on the resource?

I could also just define ['splunk']['home'] to be an empty string to get around the problem when the splunk recipe isn't on my runlist, but that feels a bit hacky too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant