- From: Peter Loron <
>
- To: "
" <
>
- Subject: [chef] Problem calling Win32::Service from recipe
- Date: Wed, 13 Mar 2013 12:14:50 -0700
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.
require 'win32/service'
target_service = "BogusServiceName"
if Win32::Service.exists?(target_service)
Chef::Log.info target_service + "Found!"
else
Chef::Log.info target_service + "NOT Found!"
end
- [chef] Problem calling Win32::Service from recipe, Peter Loron, 03/13/2013
Archive powered by MHonArc 2.6.16.