Project

General

Profile

Feature #4528

Updated by Greg Sutcliffe about 10 years ago

Facter 2 is at RC1, and while it has no structered facts by default, it will have in the future, and people will start writing their own probably even sooner. 

 I quickly looked into this using the foreman_chef plugin. I came up with this: 

 1. Add 'plainify' and 'get_key' plainify to node.rb from chef_foreman_handler, and change 'build_body' build_body to call: 

     {'facts' => plainify(puppet_facts['values'].merge({:_type => 'foreman_chef'})).flatten.inject(&:merge), 'name' => hostname, 'certname' => certname} 

 2. Add foreman_chef plugin to Foreman 
 3. Fix https://github.com/theforeman/foreman/blob/develop/app/services/fact_importer.rb#L79 to not drop Integers 
 4. (optional) Handle changes of fact type. Currently if you upload "foo: bar" and then upload "foo: { "bar" => "quux" }" it won't display properly due to the old string-type fact in the db. 

 We'll probably want to move the hash-handling code out of foreman_chef and into core. I'd also consider investigating the way we compress and uncompress the facts hash with '::' vs just sending/parsing the whole hash directly.

Back