[chef] Retrieving Ohai Windows system information


Chronological Thread 
  • From: " " < >
  • To: " " < >
  • Subject: [chef] Retrieving Ohai Windows system information
  • Date: Fri, 9 May 2014 17:02:57 +0000
  • Accept-language: en-GB, en-US

Good Afternoon Guys,

  I’m pretty new to Chef but have been trialling it for a few weeks. I’m running into trouble with Ohai.

I’m trying to obtain disk size for a windows node (C drive) and free space for a D: and E:

I’m getting the below error, I’m sure it’s related to the way I’m calling the node info but I’m not au fait enough with chef yet to know.

Code:

cdskfr = node[:filesystem][c:]['kb_size']

ddskfr = node[:filesystem][d:]['kb_available']

edskfr = node[:filesystem][e:]['kb_available']

 

and the error I get is:

<nodename> [2014-05-09T12:41:50-04:00] FATAL: Chef::Exceptions::ImmutableAttributeModification: Node attributes are read-only when you do not specify which precedence level to set. To set an attribute use code like `node.default["key"] = "value"'

 

I’ve spent a lot of time googling this and can find plenty of info on how to create custom plugins, but no info on how to retrieve info that is clear.  This is not a custom plugin that I have written, just the usual ones bundled with Chef.

I can retrieve a hostname with Ohai with no problem.

Any useful comments/pointers greatly appreciated.

 

Thanks

Chris




Archive powered by MHonArc 2.6.16.

§