facts/scripts/get_facts.rb in simp-rspec-puppet-facts-2.0.0 vs facts/scripts/get_facts.rb in simp-rspec-puppet-facts-2.0.1
- old
+ new
@@ -4,6 +4,14 @@
ENV.fetch('FACTERLIB').split(':').each{|x| Facter.search x }
Puppet.initialize_settings
Facter.loadfacts
-jj JSON.parse Facter.collection.to_hash.to_json
+
+data = Facter.collection.to_hash
+facter_major_ver = Facter.version.split('.').first
+if ['1','2'].include? facter_major_ver
+ facts = data
+elsif ['1','2'].include? facter_major_ver
+ facts = data['values']
+end
+jj JSON.parse facts.to_json