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

Move the forwarder_monitor validation to the provider? #91

Description

@gravesb

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions