[chef] Re: knife/ohai


Chronological Thread 
  • From: Julio Lajara < >
  • To: Ranjib Dey < >,
  • Cc: " " < >
  • Subject: [chef] Re: knife/ohai
  • Date: Thu, 03 Apr 2014 15:34:01 -0400

Im looking for local machine data on which knife is actually being run. If I cant get it from Ohai directly ill try host_os from rbconfig but was looking for Ohai first.

Thanks,

On 04/03/2014 03:31 PM, Ranjib Dey wrote:
" type="cite">
you mean the remote node data stored in chef server ? or the local machine's data?

ohai can be invoked directly as:
o = Ohai::System.new ; o.all_plugins ; o[:attr] . 

but this will slow down knife loading ,
for the nodes in chef server, it may be wiser to do that logic on a plugin.
Chef::Node.load('foo')[:attr1] , 
as this requires rest/http stuff , which in turn requires chef to to be configured (i.e. knife.rb)... you may be able to do this with sufficient hacks.. but it might be worth discussing what exactly you are trying to do instead, and check if theres a cleaner way to do so 

best
ranjib


On Thu, Apr 3, 2014 at 12:11 PM, Julio Lajara < " target="_blank"> > wrote:
Is it possible to use data from Ohai in a knife.rb file? Ive been looking for a way to use platform_family? but not sure if this can be called directly or is in some hash if its even available.

Thanks,





Archive powered by MHonArc 2.6.16.

§