How to determine windows node OS info in a cookbook?


#1

I’m working on a cookbook that downloads and installs a MSI. However, I need to know if the node running the cookbook is 32 or 64 bit Windows. Any pointers on this?

Thanks.

-Pete


#2

If the environmental variable programfiles(x86) exists you are on 64 bit windows. This is how the windows cookbook determines the bittedness of the os.

On Feb 7, 2013, at 7:42 PM, “Peter Loron” peterl@standingwave.org wrote:

I’m working on a cookbook that downloads and installs a MSI. However, I need to know if the node running the cookbook is 32 or 64 bit Windows. Any pointers on this?

Thanks.

-Pete


#3

You can use node[“processor”][“machine”] to detect this. It will return i386 or x86_64, depending on the whether it is 32 or 64-bit respectively.

On Thursday, February 7, 2013 at 9:41 PM, Peter Loron wrote:

I’m working on a cookbook that downloads and installs a MSI. However, I need to know if the node running the cookbook is 32 or 64 bit Windows. Any pointers on this?

Thanks.

-Pete


#4

Try running Ohai on the node to see what attributes are available. That information is deffinetly there.

-Tim

On Feb 7, 2013, at 7:41 PM, Peter Loron peterl@standingwave.org wrote:

I’m working on a cookbook that downloads and installs a MSI. However, I need to know if the node running the cookbook is 32 or 64 bit Windows. Any pointers on this?

Thanks.

-Pete


#5

Hi, Larry. This did not seem to be exposed in the cookbook, and I didn’t find it when I looked in ohai output either. I’m using Chef 0.11.2, so maybe that was changed?

-pete

On Feb 7, 2013, at 7:47 PM, Larry Wright larrywright@gmail.com wrote:

You can use node[“processor”][“machine”] to detect this. It will return i386 or x86_64, depending on the whether it is 32 or 64-bit respectively.

On Thursday, February 7, 2013 at 9:41 PM, Peter Loron wrote:

I’m working on a cookbook that downloads and installs a MSI. However, I need to know if the node running the cookbook is 32 or 64 bit Windows. Any pointers on this?

Thanks.

-Pete


#6

That did the trick! Thanks Paul.

-pete

On Feb 7, 2013, at 7:47 PM, Paul Morton - BIA pmorton@biaprotect.com wrote:

If the environmental variable programfiles(x86) exists you are on 64 bit windows. This is how the windows cookbook determines the bittedness of the os.

On Feb 7, 2013, at 7:42 PM, “Peter Loron” peterl@standingwave.org wrote:

I’m working on a cookbook that downloads and installs a MSI. However, I need to know if the node running the cookbook is 32 or 64 bit Windows. Any pointers on this?

Thanks.

-Pete