I’ve got a simple recipe I’m working on to set up some of our custom Windows services. I’m trying to invoke the win32-service gem to check for the existence of a service. I’m using Chef 11.2.0.
When I make the chef-client run, it fails with a “Recipe Compile Error”, “uninitialized constant Chef::Win32::Service”.
The recipe code is below. I’m sure I’m just missing something basic but I’m not sure what. I’ve found other examples of Chef code out there using this syntax. I looked down in the bowels of the omnibus installed ruby and the win32-service gem is there, and I don’t get an error on the require. When I run something like this from the command-line on the client box, it succeeds. The omnibus ruby is the only one on that machine.
Any pointers? Clue stick? Thanks.
target_service = “BogusServiceName”
Chef::Log.info target_service + "Found!"
Chef::Log.info target_service + "NOT Found!"