[FACT-601] Facter produces mangled output with plaintext output and structured data Created: 2014/06/23 Updated: 2015/01/14 Resolved: 2014/06/24 Status: Project: Component/s: Affects Version/s: Fix Version/s: Closed Facter None None Type: Reporter: Resolution: Labels: Remaining Estimate: Time Spent: Original Estimate: Bug Adrien Thebo Fixed None Not Specified Template: Story Points: Sprint: QA Status: customfield_10700 true 1 Week 2014-6-18 to 2014-6-25 Reviewed FACT 2.1.0 Priority: Assignee: Votes: Major Ethan Brown 0 Not Specified Not Specified Description Facter uses the default `to_s` method when printing facts via plaintext. On Ruby 1.8.7 this produces badly mangled output which makes it difficult to read structured facts on the terminal without using YAML or JSON. Comments Comment by Ethan Brown [ 2014/06/24 ] Tested on OSX Mavericks 10.9 using sample structured fact Facter.add(:interfaces_array) do setcode do interfaces = Facter.value(:interfaces) # the 'interfaces' fact returns a single comma-delimited string, e.g., "lo0,eth0,eth1" interfaces_array = interfaces.split(',') interfaces_array end end Facter.add(:interfaces_hash) do setcode do interfaces_array = Facter.value(:interfaces_array) interfaces_hash = {} interfaces_array.each do |interface| ipaddress = Facter.value("ipaddress_#{interface}") if ipaddress interfaces_hash[interface] = ipaddress end end interfaces_hash end end Prior to merge: interfaces_array => lo0gif0stf0en0en3en4bridge0p2p0vmnet1vmnet2vmnet8 interfaces_hash => lo0127.0.0.1vmnet1192.168.121.1vmnet2192.168.42.1vmnet8172.16.253.1en0192. After merge commit: interfaces_array => ["lo0", "gif0", "stf0", "en0", "en3", "en4", "bridge0" "vmnet1", "vmnet2", "vmnet8"] interfaces_hash => {"vmnet1"=>"192.168.121.1", "vmnet2"=>"192.168.42.1", "vmnet8"=>"172.16.253.1", "lo0"=>"127.0.0.1", "en0"=>"192.168.0.102"} Looks good to me! Comment by Ethan Brown [ 2014/06/24 ] Ship it Generated at Tue Feb 09 17:53:44 PST 2016 using JIRA 6.4.12#64027sha1:e3691cc1283c0f3cef6d65d3ea82d47743692b57.