[chef] Re: Re: Accessing environment variables in Windows


Chronological Thread 
  • From: Madhurranjan Mohaan < >
  • To:
  • Subject: [chef] Re: Re: Accessing environment variables in Windows
  • Date: Thu, 19 Jan 2012 00:32:42 +0530

Paul,

It definitely helps. We can ignore the 1st one for now.

Thanks
Ranjan

On Wed, Jan 18, 2012 at 8:03 PM, Paul Morton - BIA < "> > wrote:
Hello - I am not sure that I understand your first issue. On the second issue, there are various ways to access variables. To use environmental vars, ruby stores them in a constant ENV which is a has and can be access like this: ENV['COMPUTERNAME'].

The recipe is just ruby, so you can create other variables and just use them. I.e.

config_file = "\\\\fileserver\\configs\\#{ENV['COMPUTERNAME']}"

Does that help?

P

On Jan 18, 2012, at 3:14 AM, "Madhurranjan Mohaan" < "> > wrote:

> Hi ,
>
> I need to access Environment variables in Windows while running the cookbooks. I have had 2 issues with this:
> 1. When I run with powershell and access them using $Env:HOME  ( for example) and run "chef client" manually on the box , it seems to pick it up but when I run it from my CI , it doesn't seem to work since the path seems to change. I have been trying to echo this variable on the console but haven't been successful.  How do we do this ?
>
> 2. If I am not using the powershell cookbook and I use the "remote_file" or "remote_directory" resource to copy folders ( This works fine when I hardcode the paths) , in that case, how do I access the PATH or the HOME variable ( or basically any other Environment variable ) in my cookbooks?
>
> Can you shed some light on this ?
>
> thanks
> Ranjan




Archive powered by MHonArc 2.6.16.

§