cookbooks / chef-client

A Chef cookbook for chef-client
http://cookbooks.github.com/chef-client
6 stars 6 forks source link

Install as service fails on Windows #9

Open janaka opened 11 years ago

janaka commented 11 years ago

It would appear that this doesn't work on windows (Win2012) out of the box, it throws and error. It would seem this is because the c:\chef\logs folder doesn't exist hence it cannot write the logs to disk. Creating the folder manually seems to allow the recipe to run and the service to start without any errors.

Chef client was installed using the msi.

janaka commented 11 years ago

The error msg in the event log

Service cannot be started. System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\chef\log\chef-client.wrapper.log'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITYATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize) at System.IO.StreamWriter..ctor(String path, Boolean append) at winsw.WrapperService.WriteEvent(String message) at winsw.WrapperService.OnStart(String[] ) at System.Servic...

janaka commented 11 years ago

Two workarounds 1) creating the c:\chef\log in something like a cloudformations template 2) create an override attribute log_dir on a role and change to a folder that exists such as c:\chef.

As c:\chef\log is the default I would say this cookbook should deal with creating this folder it it doesn't exist.