[chef] Re: Re: Silent installer for windows chef client


Chronological Thread 
  • From: Paul Morton - BIA < >
  • To: " " < >
  • Subject: [chef] Re: Re: Silent installer for windows chef client
  • Date: Mon, 12 Dec 2011 10:11:52 -0800
  • Accept-language: en-US
  • Acceptlanguage: en-US

To clarify further. Environmental variables are not just loaded at login.

1. New instances of cmd prompt in the same windows session will enumerate the new env vars. This is why you are able to close on command prompt and open another in which knife will work. If you are looking for a hacky work around for this type of problem, http://stackoverflow.com/questions/171588/is-there-a-command-to-refresh-environment-variables-from-the-command-prompt-in-w

2. For an even (or maybe less) hackier work around, just  set PATH=%PATH%;c:\opscode\bin;c:\opscode\embedded\bin. This will add the ops code directories to you current cmd.exe session.  

3. Using the Win32 API it is possible to notify other processes that environmental variables have changed. (See https://github.com/opscode/chef/blob/master/chef/lib/chef/provider/env/windows.rb#L66 for an example). The unfortunate part is that cmd.exe does not subscribe to this event.

Paul

On Dec 12, 2011, at 5:56 AM, Tensibai wrote:

Le 12.12.2011 14:29, Madhurranjan Mohaan a écrit :

Apologies : the following works : 

msiexec /qb /i chef-client-0.10.4-6.msi
Problem though is that there is an issue with the Path environment variable. The environment variable "PATH" is appended with the c:\opscode\bin and c:\opscode\embedded\bin but for it to reflect on a new command prompt, I have to go to My computer, -> Environment variables -> open the path Variable -> click OK and then close which is weird and then running "knife" just works fine. WIthout doing that , it doesn't seem to work .
thanks
Ranjan

Indeed, env vars are loaded at logon... so after an install you have to tell the system to reload your env variables.

Same as in unix when editing your .profile, untill you reload it you won't have access to new values.





Archive powered by MHonArc 2.6.16.

§