lib/simp/rspec-puppet-facts.rb in simp-rspec-puppet-facts-2.2.1 vs lib/simp/rspec-puppet-facts.rb in simp-rspec-puppet-facts-2.3.0
- old
+ new
@@ -12,11 +12,11 @@
hardwaremodels = opts.fetch(:hardwaremodels, ['x86_64'])
os_strings = []
supported_os.each do |os|
os['operatingsystemrelease'].each do |rel|
hardwaremodels.each do |hw|
- os_strings << [os['operatingsystem'],rel,hw].map{|x| x.downcase }.join('-')
+ os_strings << [os['operatingsystem'],rel,hw].map{|x| x.downcase.gsub(/\s/,'_') }.join('-')
end
end
end
os_strings
end
@@ -28,11 +28,11 @@
rfh_os = opts.fetch(:supported_os, RspecPuppetFacts.meta_supported_os).dup
_os = rfh_os.send(filter_type) do |os|
_name = os['operatingsystem']
_rels = os['operatingsystemrelease'].send(filter_type) do |rel|
_hw = rfh_hw.send(filter_type) do |hw|
- simp_h.key? [_name,rel,hw].map{|x| x.downcase }.join('-')
+ simp_h.key? [_name,rel,hw].map{|x| x.downcase.gsub(/\s/,'_') }.join('-')
end
!_hw.empty?
end
!_rels.empty?
end
@@ -51,10 +51,11 @@
masked_opts = filter_opts(opts, simp_h, :reject)
selected_opts = filter_opts(opts, simp_h, :select)
rfh_h = Simp::RspecPuppetFacts::Shim.on_supported_os(masked_opts)
h = rfh_h.merge(simp_h).select{|k,v| supported_os_strings(opts).include? k}
+
h.each do | os, facts |
facter_ver=Facter.version[0..2]
facts_file = File.expand_path("../../facts/#{facter_ver}/#{os}.facts",
File.dirname(__FILE__))
if File.file? facts_file
@@ -85,9 +86,11 @@
h
end
def lsb_facts( facts )
+ return facts if facts[:kernel].casecmp('windows')
+
lsb_facts = {}
# attempt to massage a major release version if missing (for facter 1.6)
unless ENV['SIMP_FACTS_lsb'] == 'no'
puts "==== mocking lsb facts [disable with SIMP_FACTS_lsb=no]" if ENV['VERBOSE']
rel = facts.fetch(:operatingsystemmajrelease,