In a recipe I want to check to see if a service is installed, and if it is not notify the 3 resources needed to install it. I tried the service resource, which correctly identifies the service when it is installed, but throws an exception if the service is not installed.
I'm not sure what action to use here. :nothing just skips the resource so it ever get executed, but any of the other actions will error when they attempt to act on a service that doesn't exist.
How do I detect whether a service is installed and act based on that information?
I'm running on Windows, if that's relevant.
if !::Win32::Service.exists?("test_service_name")
correctly detects whether the service exists. The leading :: tell it not to look in the Chef namespace. – Cobbs