Issue #18323 has been updated by Josh Cooper.
Status changed from Accepted to Duplicate
This was fixed as part of fixing #20303 and moving to ruby 1.9 for puppet
3.2.x. Now given a manifest saved in cp866:
<pre>
user { 'Евгений':
ensure => present,
password => 'Pass123!!!',
}
</pre>
I can do the following:
<pre>
C:\work\puppet>chcp 866
C:\work\puppet>bundle exec puppet apply user.pp
Notice: /User[Евгений]/ensure: created
Notice: Finished catalog run in 0.08 seconds
C:\work\puppet>net user Евгений
User name Евгений
Full Name Евгений
</pre>
However, puppet writes out a yaml statefile with binary data:
<pre>
C:\work\puppet>cat C:/ProgramData/PuppetLabs/puppet/var/state/state.yaml
---
"File[C:/ProgramData/PuppetLabs/puppet/etc]":
!ruby/sym checked: 2013-05-30 21:59:28.750822 -07:00
...
!binary ? "VXNlcluFoqOlraipXQ==\n"
:
!ruby/sym checked: 2013-05-30 21:59:31.511615 -07:00
!ruby/sym synced: 2013-05-30 21:59:31.527212 -07:00
</pre>
And that prevents puppet from running again:
<pre>
C:\work\puppet>bundle exec puppet apply user.pp
Error: Could not run: (<unknown>): mapping keys are not allowed in this context
at line 47 column 11
</pre>
This latter issue is part of the larger UTF-8 discussions, which is #20522.
----------------------------------------
Bug #18323: Windows user provider fails to create user with non-ASCII characters
https://projects.puppetlabs.com/issues/18323#change-91934
* Author: Josh Cooper
* Status: Duplicate
* Priority: Normal
* Assignee:
* Category:
* Target version:
* Affected Puppet version: 2.7.6
* Keywords: windows adsi i18n
* Branch:
----------------------------------------
The windows_adsi user provider essentially does the following when creating a
user:
<pre>
require 'Win32API'
require 'win32ole'
def computer_name
buf = " " * 128
Win32API.new('kernel32', 'GetComputerName', ['P','P'], 'I').call(buf,
buf.length.to_s)
buf.unpack("A*")
end
conn = WIN32OLE.connect("WinNT://#{computer_name}")
user = conn.Create('user', name)
user.SetPassword(password)
user.SetInfo
</pre>
On Ruby 1.8.7, this succeeds, but results in a corrupt username when using the
name 'Евгений'. I think this is because ruby's implementation (win32ole.c)
defaults to ANSI codepage, so internally it tries to convert
MultiByteToWideChar using the wrong codepage. There is a `WIN32OLE.codepage=`
method, but it only accepts a select number of options in 1.8.7.
Also the `Puppet::Util::ADSI.computer_name` calls `buf.unpack('A*')` when
building the ADSI connection string. This returns an array, instead of a
string. In ruby 1.8.7, it automatically converts the array to a string.
On Ruby 1.9.3, WIN32OLE uses the right code page, and puppet would set the
username correctly, but since ruby 1.9 doesn't automatically convert the array
to a string, it fails. The `buf.unpack('A*')` line should be removed as it
serves no purpose. Once that is done, then things should work as expected on
ruby 1.9
--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.