Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible encodings with ChefDK 0.10.0 and Windows 10 DE #332

Closed
damphyr opened this issue Jan 25, 2016 · 4 comments
Closed

Incompatible encodings with ChefDK 0.10.0 and Windows 10 DE #332

damphyr opened this issue Jan 25, 2016 · 4 comments

Comments

@damphyr
Copy link

damphyr commented Jan 25, 2016

I'm having big trouble convincing Chef client to execute a recipe on a German Windows 10 installation.

The recipe is

nasty_tasks=["\\Microsoft\\Windows\\Customer Experience Improvement Program\\Consolidator",
  "\\Microsoft\\Windows\\Customer Experience Improvement Program\\KernelCEIPTask",
  "\\Microsoft\\Windows\\Customer Experience Improvement Program\\Use CEIP",
  "\\Microsoft\\Windows\\Application Experience\\AitAgent",
  "\\Microsoft\\Windows\\Application Experience\\Microsoft Compatibility Appraiser",
  "\\Microsoft\\Windows\\Application Experience\\ProgramDataUpdater"
]

nasty_tasks.each do |t|
  windows_task t do
    action :delete
  end  
end

and Chef ends with an incompatible encoding error (CP850 to ASCII-8BIT) and a message that points to the line beginning with nasty_tasks. But the error message mentions "block in from_file" and references the local cache which leads me to believe that someone forgot to read the files in with "rb". So this might be a core Chef error and not relevant to the cookbook...

Tried it with both ChefDK 0.9 and ChefDK 0.10. The system language (meaning the language Windows is installed in) needs to be other than English for this to be reproducible.

Same thing when using the windows_package resource.

windows cookbook version 1.38.2

Any hints on how to work around this other than reinstalling Windows?

@mwrock
Copy link
Contributor

mwrock commented Jan 25, 2016

sometimes the stack traces from cklient runs are less than helpful. Can you include the stack trace emitted when running with debug logging (`-l debug) or the one in the stacktrace.out file on the node?

@damphyr
Copy link
Author

damphyr commented Jan 26, 2016

I found the problem: The user name contains non-ASCII characters (in this case a ü), so the path cannot be mapped.

The stackrace (which unfortunately doesn't even hint at the problem):

Generated at 2016-01-25 14:39:19 +0100
Encoding::CompatibilityError: windows_package[Ruby 2.1.7-p400] (windev::packages line 24) had an error: Encoding::CompatibilityError: incompatible character encodings: IBM437 and ASCII-8BIT
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/mixlib-shellout-2.2.3-universal-mingw32/lib/mixlib/shellout/windows/core_ext.rb:132:in `join'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/mixlib-shellout-2.2.3-universal-mingw32/lib/mixlib/shellout/windows/core_ext.rb:132:in `create'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/mixlib-shellout-2.2.3-universal-mingw32/lib/mixlib/shellout/windows.rb:80:in `run_command'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/mixlib-shellout-2.2.3-universal-mingw32/lib/mixlib/shellout.rb:259:in `run_command'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/mixin/shell_out.rb:97:in `shell_out_command'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/mixin/shell_out.rb:50:in `shell_out'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/mixin/shell_out.rb:55:in `shell_out!'
l:/scripts/local-mode-cache/cache/cookbooks/windows/libraries/windows_package.rb:102:in `install_package'
l:/scripts/local-mode-cache/cache/cookbooks/windows/libraries/windows_package.rb:29:in `block in <class:WindowsCookbookPackage>'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/provider/lwrp_base.rb:86:in `instance_eval'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/provider/lwrp_base.rb:86:in `block in action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/provider.rb:144:in `run_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/resource.rb:585:in `run_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/runner.rb:49:in `run_action'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/runner.rb:81:in `block (2 levels) in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/runner.rb:81:in `each'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/runner.rb:81:in `block in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/resource_collection/resource_list.rb:83:in `block in execute_each_resource'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/resource_collection/resource_list.rb:81:in `execute_each_resource'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/runner.rb:80:in `converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/client.rb:653:in `block in converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/client.rb:648:in `catch'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/client.rb:648:in `converge'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/client.rb:687:in `converge_and_save'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/client.rb:269:in `run'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/application.rb:252:in `run_with_graceful_exit_option'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/application.rb:229:in `block in run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/local_mode.rb:44:in `with_server_connectivity'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/application.rb:212:in `run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/application/client.rb:408:in `block in interval_run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/application/client.rb:398:in `loop'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/application/client.rb:398:in `interval_run_chef_client'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/application/client.rb:388:in `run_application'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/lib/chef/application.rb:60:in `run'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1-universal-mingw32/bin/chef-client:26:in `<top (required)>'
C:/opscode/chefdk/bin/chef-client:64:in `load'
C:/opscode/chefdk/bin/chef-client:64:in `<main>'

@damphyr
Copy link
Author

damphyr commented Jan 26, 2016

The recipe referenced in the stacktrace is part of the windev cookbook and is nothing special (just iterating over an array and calling windows_package)

@mwrock
Copy link
Contributor

mwrock commented Jan 26, 2016

I've been trying to repro this without luck but this is clearly an issue and doing some googling it appears to be a thing with ruby/windows. I am closing this and opening an issue in chef/mixlib-shellout#117 which is where the root of the problem lies.

@mwrock mwrock closed this as completed Jan 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants