[chef] Re: Re: Updating PATH on windows for use in subsequent recipes


Chronological Thread 
  • From: Kenneth Barry < >
  • To: " " < >
  • Subject: [chef] Re: Re: Updating PATH on windows for use in subsequent recipes
  • Date: Tue, 20 May 2014 05:03:26 -0700

This is how we do it. its in our base recipe for windows :)

powershell_script "Add path to appcmd to Environment PATH" do
code <<-EOB
$PathToAdd = "%windir%\\system32\\inetsrv"
$VerifiedPathsToAdd = $null
  Foreach($Path in $PathToAdd) {            
  if($env:Path -like "*$Path*") {
    }
    else { 
    $VerifiedPathsToAdd += ";$Path"
    }            
  if($VerifiedPathsToAdd -ne $null) {
    [Environment]::SetEnvironmentVariable("Path",$env:Path + $VerifiedPathsToAdd,"Machine")            
    }
  }
EOB
end


On Mon, May 19, 2014 at 11:19 PM, Julian C. Dunn < " target="_blank"> > wrote:
We do it in the 'php' cookbook like this:

https://github.com/opscode-cookbooks/php/blob/master/recipes/package.rb#L54-L55

- Julian

On Mon, May 19, 2014 at 1:46 PM, Jeppe Nejsum Madsen < "> > wrote:
> Hi
>
> Is there a way to force reload of the PATH variable on windows?
>
> We install git & nodejs and then tries to install some npm packages from a
> git repo.
>
> But in the initial run, npm cannot find git because the current process'
> PATH is not updated.
>
> Starting a new shell and running chef-client solves the issue, but this is
> of course less than ideal.
>
> Any ideas?
>
> /Jeppe
>
>
>



--
[ Julian C. Dunn < "> >          * Sorry, I'm    ]
[ WWW: http://www.aquezada.com/staff/julian    * only Web 1.0  ]
[ gopher://sdf.org/1/users/keymaker/           * compliant!    ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9       ]




Archive powered by MHonArc 2.6.16.

§