Issue #21285 has been updated by Maurizio De Santis.

Using 1.9.3 I get another error:

<pre>>ruby -rfacter -e 'puts Facter.processorcount'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/facter-1.7.1/lib/facter/util/config.rb:37:i
 `join': string contains null byte (ArgumentError)
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/facter-1.7.1/lib/facter/util/c
nfig.rb:37:in `external_facts_dirs'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/facter-1.7.1/lib/facter/util/d
rectory_loader.rb:46:in `default_loader'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/facter-1.7.1/lib/facter/util/c
nfig.rb:8:in `ext_fact_loader'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/facter-1.7.1/lib/facter.rb:56:
n `collection'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/facter-1.7.1/lib/facter.rb:150
in `method_missing'
        from -e:1:in `<main>'</pre>

But it gets solved with the same solution ( Dir::COMMON_APPDATA.encode('ASCII') 
)

----------------------------------------
Bug #21285: Facter.processorcount fails on Windows 64bit
https://projects.puppetlabs.com/issues/21285#change-93138

* Author: Maurizio De Santis
* Status: Needs More Information
* Priority: Normal
* Assignee: 
* Category: windows
* Target version: 
* Keywords: windows
* Branch: 
* Affected Facter version: 1.7.1
----------------------------------------
I'm running facter 1.7.1, Ruby 64bit 2.0.0-p195 via RubyInstaller on Windows 7 
64bit; running Facter.fact(:processorcount) I get this error:

<pre>
irb(main):002:0> Facter.fact(:processorcount)
Encoding::CompatibilityError: path name must be ASCII-compatible (UTF-16LE): 
"C:\\ProgramData"
        from 
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/facter-1.7.1/lib/facter/util/config.rb:37:in
 `join'
        from 
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/facter-1.7.1/lib/facter/util/config.rb:37:in
 `external_facts_dirs'
        from 
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/facter-1.7.1/lib/facter/util/directory_loader.rb:46:in
 `default_loader'
        from 
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/facter-1.7.1/lib/facter/util/config.rb:8:in
 `ext_fact_loader'
        from 
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/facter-1.7.1/lib/facter.rb:56:in 
`collection'
        from 
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/facter-1.7.1/lib/facter.rb:112:in 
`block (2 levels) in singleton class'
        from (irb):2
        from C:/Ruby200-x64/bin/irb:12:in `<main>'
</pre>

It works modifing Facter::Util::Config.windows_data_dir as follows:

<pre>
  def self.windows_data_dir
    if Dir.const_defined? 'COMMON_APPDATA' then
      Dir::COMMON_APPDATA.encode('ASCII')
    else
      nil
    end
  end
</pre>


-- 
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