Issue #21946 has been updated by Josh Cooper.

Awesome...  so I don't understand this completely, but it appears that when you 
call `Facter.flush` the second time in the debugger, the `Resolution#to_s` 
method is getting called (presumably because the debugger is trying to `to_s` 
what comes back). But since we just flushed the resolution, `@value` is nil, so 
we try to evaluate the resolution, even though it's not suitable (effectively 
skipping any sort of confine check). I don't think this is Windows specific, 
but a result of the `flush` capability that was recently added.

Btw, this change avoids the issue:

<pre>
diff --git a/lib/facter/util/collection.rb b/lib/facter/util/collection.rb
index cb9359b..169176b 100644
--- a/lib/facter/util/collection.rb
+++ b/lib/facter/util/collection.rb
@@ -96,6 +96,7 @@ class Facter::Util::Collection
   # Flush all cached values.
   def flush
     @facts.each { |name, fact| fact.flush }
+    nil
   end
</pre>

Because we no longer leak the `@facts` hash, to the caller, so the debugger 
doesn't try to `to_s` it. But I don't think that's the right solution.

----------------------------------------
Bug #21946: Facter 1.7.2 fails trying to load win32 support code when flushed, 
if facts are collected first.
https://projects.puppetlabs.com/issues/21946#change-95467

* Author: Daniel Pittman
* Status: Unreviewed
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* Keywords: 
* Branch: 
* Affected Facter version: 
----------------------------------------
<pre>
⚡ irb
1.9.3p448 :001 > require 'facter'
 => true
1.9.3p448 :002 > Facter.flush
 => {}
1.9.3p448 :003 > Facter.to_hash
 => {"architecture"=>"x86_64", "kernel"=>"Darwin", "domain"=>"local", 
"macaddress"=>"c8:bc:c8:d8:4f:04", "osfamily"=>"Darwin", 
"operatingsystem"=>"Darwin", "facterversion"=>"1.7.2", "fqdn"=>"ea.local", 
"hardwareisa"=>"i386", "hardwaremodel"=>"x86_64", "hostname"=>"ea", 
"id"=>"daniel", "interfaces"=>"lo0,gif0,stf0,en0,en1,p2p0,fw0,utun0", 
"ipaddress_lo0"=>"127.0.0.1", "netmask_lo0"=>"255.0.0.0", "mtu_lo0"=>"16384", 
"mtu_gif0"=>"1280", "mtu_stf0"=>"1280", "macaddress_en0"=>"c8:bc:c8:96:67:51", 
"mtu_en0"=>"1500", "ipaddress_en1"=>"172.16.23.10", 
"macaddress_en1"=>"c8:bc:c8:d8:4f:04", "netmask_en1"=>"255.255.255.0", 
"mtu_en1"=>"1500", "macaddress_p2p0"=>"0a:bc:c8:d8:4f:04", "mtu_p2p0"=>"2304", 
"macaddress_fw0"=>"dc:2b:61:ff:fe:c3", "mtu_fw0"=>"4078", "mtu_utun0"=>"1380", 
"ipaddress"=>"172.16.23.10", 
"ipaddress6"=>"fdf5:88f4:b79b:fb9d:182b:22c8:34da:93fb", 
"kernelmajversion"=>"12.4", "kernelrelease"=>"12.4.0", 
"kernelversion"=>"12.4.0", "sp_mmm_entry"=>"{\"MMM_state\"=>\"MMM_enabled\"}", 
"sp_smc_version_system"=>"1.57f18", "sp_boot_rom_version"=>"MBP61.0057.B0F", 
"sp_cpu_interconnect_speed"=>"4.8 GT/s", "sp_cpu_type"=>"Intel Core i7", 
"sp_current_processor_speed"=>"2.66 GHz", "sp_l2_cache_core"=>"256 KB", 
"sp_l3_cache"=>"4 MB", "sp_machine_model"=>"MacBookPro6,1", 
"sp_machine_name"=>"MacBook Pro", "sp_number_processors"=>"2", 
"sp_packages"=>"1", "sp_physical_memory"=>"8 GB", 
"sp_platform_uuid"=>"EEB64BA1-A0EF-5B7E-993B-82C448DE936C", 
"sp_serial_number"=>"C02DH0UFDC7C", "sp_boot_mode"=>"normal_boot", 
"sp_boot_volume"=>"ea", "sp_kernel_version"=>"Darwin 12.4.0", 
"sp_local_host_name"=>"ea", "sp_os_version"=>"OS X 10.8.4 (12E55)", 
"sp_secure_vm"=>"secure_vm_enabled", "sp_uptime"=>"up 8:0:3:34", 
"sp_user_name"=>"Daniel Pittman (daniel)", "macosx_productname"=>"Mac OS X", 
"macosx_productversion"=>"10.8.4", "macosx_buildversion"=>"12E55", 
"macosx_productversion_major"=>"10.8", "macosx_productversion_minor"=>"4", 
"productname"=>"MacBookPro6,1", "memorysize"=>"8.00 GB", "memoryfree"=>"2.32 
GB", "swapsize"=>"5.00 GB", "swapfree"=>"882.00 MB", "swapsize_mb"=>"5120.00", 
"swapfree_mb"=>"882.00", "memorysize_mb"=>"8192.00", 
"memoryfree_mb"=>"2374.40", "swapencrypted"=>true, "memorytotal"=>"8.00 GB", 
"netmask"=>"255.255.255.0", "network_lo0"=>"127.0.0.0", 
"network_en1"=>"172.16.23.0", "operatingsystemrelease"=>"12.4.0", 
"path"=>"/Users/daniel/.rvm/gems/ruby-1.9.3-p448/bin:/Users/daniel/.rvm/gems/ruby-1.9.3-p448@global/bin:/Users/daniel/.rvm/rubies/ruby-1.9.3-p448/bin:/Users/daniel/.rvm/gems/ruby-1.9.3-p448@puppet/bin:/Users/daniel/.rvm/gems/ruby-1.9.3-p448@global/bin:/Users/daniel/.rvm/rubies/ruby-1.9.3-p448/bin:/Users/daniel/.rvm/bin:/Users/daniel/puppetlabs/puppet/sbin:/Users/daniel/puppetlabs/puppet/bin:/Users/daniel/puppetlabs/facter/sbin:/Users/daniel/puppetlabs/facter/bin:/Users/daniel/bin:/opt/local/sbin:/opt/local/bin:/usr/local/sbin:/sbin:/usr/sbin:/usr/local/bin:/bin:/usr/bin:/opt/local/share/java/android-sdk-mac_x86/tools:/opt/local/share/java/android-sdk-mac_x86/platform-tools:/Users/daniel/src/puppet-workflow",
 "processorcount"=>"4", "ps"=>"ps auxwww", "puppetversion"=>"3.2.1", 
"rubysitedir"=>"/Users/daniel/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1",
 "rubyversion"=>"1.9.3", 
"sshdsakey"=>"AAAAB3NzaC1kc3MAAACBANy7b6vdy1mswnEgmmFaW+HJTrAi10VCzrA4av9EPl1rpuiD6X+TSwVbNgJmXSF9AG99UDfG8lLrjBvFHa8OE1E+kUYRSQg9x0nwQDuEkiocOFGSlX1htaxbNdQlfB+dLpURTkjHP62xD0mI+yyoEffiTemY5PffgKy3vppch9HhAAAAFQDx4Kh3/GCfKqV4QXDafksSiYRQOwAAAIBMT+Rn6p4+d94XrEg+S/aVE1sOU70onkjQymdbjwJai3xtq6o0tTgBkil3zDcdA8ULUodo/MQexgmmKyJM4KKwcWN7hfadp6SW0Awfjcw2GdmVXaAjVkLBzsJ9OdQ3Kv5qFAcUp8Es+987D+gQxhoG/3PTv9nig91pl23BV6yF/AAAAIBWS5MlUI89nuUCdiIk2HQR4QojyRG6pkaY/NXNXfuFgVK/st493xzKjYNt4EejBLqxb0U4mb7IbF0t/5q9Q4jUtNx0Wu4wdRwv98kCCZqtO1ek+pv+PN5JnW5NNwgtSNvemT5RnAPozn05XCFpuW7o7mzTOSbSwBOuGmCoMbdqZw==",
 "sshfp_dsa"=>"SSHFP 2 1 35cc847de72a18c50d902c491ae2043d9619fd89\nSSHFP 2 2 
5fe079ce07a6b5d9df687572301f2859f99fa87b31d1e3fcb1ab29417c86ba1b", 
"sshrsakey"=>"AAAAB3NzaC1yc2EAAAABIwAAAQEAxLOb0oLEHeZa7wAhnUmk10IvWrSe3OCb5Urm4VcEtaODjf9g44pUr9ZKjQDf5PvaAe+1N9Dt67oVGA4G/4tfB8draQAGFTqSnhRux9uru/C9Vocv2UcNsfZTGT+6ytv4iMX1BST/9y8cyMvk4+8il/nK/svPFdn7fbSrqFpuCrbpmhihilUG+aPm0q/rtWOQBP7YhJDOJmU2JNUcObl+f9ERi3tXD/YqbU9UqbO4uP7Uy/s2ci+1XRkHfF77Bhg8Gv1ZlPbIUUzO1OK12Q/3NdXjdgbDV3HXb6e7eNAsJgHy7B3dvxW6RMmmFyJ529OlL57XmxYgRcm2Sxrxrn5ObQ==",
 "sshfp_rsa"=>"SSHFP 1 1 4e1b7d8c1b026ab42ffc04baf1d28c963b8aef63\nSSHFP 1 2 
3fea8827e05360d77b056934d2b598281de66dc931dbe2c56dfaaa6db18d00db", 
"timezone"=>"PDT", "uptime"=>"8 days", "uptime_days"=>8, "uptime_hours"=>192, 
"uptime_seconds"=>691385, "virtual"=>"physical", "is_virtual"=>"false"}
1.9.3p448 :004 > Facter.flush
LoadError: cannot load such file -- win32/registry
        from 
/Users/daniel/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
 `require'
        from 
/Users/daniel/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
 `require'
        from /Users/daniel/puppetlabs/facter/lib/facter/util/registry.rb:4:in 
`hklm_read'
        from /Users/daniel/puppetlabs/facter/lib/facter/domain.rb:74:in `block 
(2 levels) in <top (required)>'
        from 
/Users/daniel/puppetlabs/facter/lib/facter/util/resolution.rb:304:in `call'
        from 
/Users/daniel/puppetlabs/facter/lib/facter/util/resolution.rb:304:in `block in 
value'
        from 
/Users/daniel/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/timeout.rb:55:in 
`timeout'
        from 
/Users/daniel/puppetlabs/facter/lib/facter/util/resolution.rb:302:in `value'
        from 
/Users/daniel/puppetlabs/facter/lib/facter/util/resolution.rb:290:in `to_s'
        from /Users/daniel/.rvm/rubies/ruby-1.9.3-p448/bin/irb:16:in `<main>'
1.9.3p448 :005 > Facter.version
 => "1.7.2"
1.9.3p448 :006 >
</pre>

On my OS-X 10.8 current patch level machine, regular C Ruby.


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to