Why does the Puppet-Agent on Windows use a batch file?
I posted a question in the Ask PuppetLabs section and was directed to create post here as well; https://ask.puppetlabs.com/question/3506/why-does-the-puppet-agent-on-windows-use-a-batch-file/ ------------------------ Original question The Puppet Enterprise for Windows Agent runs as a windows service, basically a deamonised version of Puppet, which is all fine. However the Windows Service calls a batch file which seems extremely strange. While it does work, i.e. the Service starts and runs, using CMD.EXE as a service executable is generally considered a really bad idea. It does not respond to the usual SCM (Service Control Manager) calls and in it's current state is misconfigured e.g. The service says that it can respond to Pause and Continue events but CMD.EXE can't fulfill those requests. Also CMD.EXE does not monitor the ruby process (except for the basic operation of is it running) and vice versa. I can kill the cmd.exe process and the service manager will report that the Puppet Agent has stopped however the ruby process is still quite happily running. Either I'm missing something and CMD.EXE is an appropriate service executable or perhaps the community or puppet labs could create a better native wrapper to the ruby based puppet process. ------------------------ So I did a few tests; - You can send pause and continue messages to the service but they're just ignored even though the Services says it's Paused. - You can kill CMD.EXE service process but the Puppet Agent is still running (It becomes an orphaned process). You can then start the service again, and you'll end up with two Puppet Agents running daemonised at the same time. I'm not sure what will happen if they both try to do a catalog run at the same time, but nothing good can come of it. - CMD.EXE doesn't respond to power events e.g. going into Standby/Hibernate; but I have no idea how any service wrapper could raise that kind of event in Puppet so that it could deal with it. Does it even matter if the host goes into Standby in the middle of Puppet run? Admittedly this would be very unlikely scenario as Puppet seems to be more always-on server orientated rather than for laptop configuration management. - If you start Puppet and then quickly attempt to stop it, it get's stuck in the Stopping state and you have to kill Ruby manually. Thtat's because the service control manager raises events in a multithreaded manner, however CMD is running a single thread. If CMD.EXE is too busy to process the event then things get into a funny state. This would probably occur during a catalog run too but I haven't confirmed it. - From a troubleshooting perspective, there are no logs or diagnostic information created by CMD.EXE I'd be happy to write a service wrapper in C# and give it to the community, but before I do I want to make sure that it's really needed and I'm not trying to solve a problem that doesn't really exist. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.