Issue #4561 has been updated by Ken Barber.

In regards to using the command line tool for displaying facter output - how do 
people feel about the format?

I've managed to rig up something very simply using pretty_inspect ... thereby 
keeping the existing ruby-like output but allowing us to see hierarchy:

    test1 => ["asdf", "fdsa"]
    test2 => {"asdf"=>"fdsa"}
    test3 => {"asdf"=>["asdf", "asdf"]}
    test4 => [{"asdf"=>"fdsa"}, "bleah"]
    test5 => {"k"=>"b",
      "l"=>"c",
      "a"=>"b",
      "m"=>"d",
      "b"=>"c",
      "n"=>"f",
      "c"=>"d",
      "e"=>"f",
      "g"=>"b",
      "h"=>"c",
      "i"=>"d",
      "j"=>"f"}

We could always switch over to YAML being the default - but I kind of like the 
output of pretty print. JSON is out of the question since its not in Ruby core.

The caveat with this mechanism is that strings are now surrounded in quotes:

    uptime => "4 days"
    uptime_days => 4

Since Adrian's code catches anything that isn't an object it should look okay.
----------------------------------------
Feature #4561: Structured data should be supported
https://projects.puppetlabs.com/issues/4561

Author: Luke Kanies
Status: Code Insufficient
Priority: High
Assignee: Adrien Thebo
Category: library
Target version: 2.0.0
Keywords: 
Branch: 
https://github.com/adrienthebo/facter/tree/ticket/master/4561-add_structured_data
Affected Facter version: 


Facter currently only supports a flat result list, and it should instead 
support structured data - basically, a hash of hashes and arrays.

This should probably be able to be represented in two ways - either a hash of 
hashes/arrays, or namespaces.  That is, this:
<pre>
{:top => {:middle => {:bottom => "value"}}}
</pre>
Could also be represented as:
<pre>
top::middle::bottom = value
</pre>

We could optionally have a converter that s/::/_/g for backward compatibility, 
which should be both trivial and unnecessary, but there should definitely be 
some kind of backward compatibility mode for callers who can't deal with 
structured data.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to