Closed mwrock closed 7 years ago
Need to investigate appveyor failure. Worked against nano.
ak@ak-pc:~/Dropbox/chef-repo/cookbooks/gf_adds$ kitchen converge
-----> Starting Kitchen (v1.14.2)
-----> Converging <default-windows2008r2>...
Preparing files for transfer
Preparing dna.json
Resolving cookbook dependencies with Berkshelf 5.2.0...
Removing non-cookbook files before transfer
Preparing validation.pem
Preparing client.rb
-----> Chef Omnibus installation detected (12.17.44)
Transferring files to <default-windows2008r2>
Starting Chef Client, version 12.17.44
resolving cookbooks for run list: ["gf_adds::test"]
Synchronizing Cookbooks:
- gf_adds (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 1 resources
Recipe: gf_adds::test
* windows_package[Ай-ти отдел] action install
Recipe: <Dynamically Defined Resource>
* remote_file[C:\Users\vagrant\AppData\Local\Temp\kitchen\cache\package\npp.7.Installer.exe] action create (up to date)
- install version latest of package Ай-ти отдел
Running handlers:
Running handlers complete
Chef Client finished, 1/2 resources updated in 06 seconds
Finished converging <default-windows2008r2> (0m46.50s).
-----> Kitchen is finished. (0m49.04s)
kitchen.yml: https://gist.github.com/jugatsu/432b57fd4d078cadcab952d08d32fe4c test recipe: https://gist.github.com/jugatsu/02d22d4cac7ee1b126783a9fcfba09c1
It works now.
But i got the same error if i change elavated to false )
ak@ak-pc:~/Dropbox/chef-repo/cookbooks/gf_adds$ kitchen converge
-----> Starting Kitchen (v1.14.2)
-----> Converging <default-windows2008r2>...
Preparing files for transfer
Preparing dna.json
Resolving cookbook dependencies with Berkshelf 5.2.0...
Removing non-cookbook files before transfer
Preparing validation.pem
Preparing client.rb
-----> Chef Omnibus installation detected (12.17.44)
Transferring files to <default-windows2008r2>
Starting Chef Client, version 12.17.44
resolving cookbooks for run list: ["gf_adds::test"]
Synchronizing Cookbooks:
- gf_adds (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 1 resources
Recipe: gf_adds::test
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>> Failed to complete #converge action: [incompatible character encodings: UTF-8 and ASCII-8BIT] on default-windows2008r2
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
OS: Windows Server 2008 R2 SP1 Powershell 2.0
kitchen destroy && kitchen converge. Elevated: false Gist: https://gist.github.com/jugatsu/6f590f99c3f4559496b0ba9597069b6e
D [WinRM] Processing output
Starting Chef Client, version 12.17.44
D [WinRM] Waiting for output...
D [WinRM] Processing output
resolving cookbooks for run list: ["gf_adds::test"]
Synchronizing Cookbooks:
- gf_adds (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 1 resources
Recipe: gf_adds::test
D [WinRM] cleaning up command_id: 115F19A6-CC12-43A8-B026-5B5D34F24E35 on shell_id 69340F6F-4237-4AB7-9AAC-8E4075F7CB6E
D Cleaning up local sandbox in /tmp/default-windows2008r2-sandbox-20161219-3652-nvfxa3
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>> Failed to complete #converge action: [incompatible character encodings: UTF-8 and ASCII-8BIT] on default-windows2008r2
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
D ------Exception-------
D Class: Kitchen::ActionFailed
D Message: 1 actions failed.
>>>>>> Failed to complete #converge action: [incompatible character encodings: UTF-8 and ASCII-8BIT] on default-windows2008r2
D ----------------------
D ------Backtrace-------
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/command.rb:183:in `report_errors'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/command.rb:174:in `run_action'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/command/action.rb:36:in `block in call'
D /opt/chefdk/embedded/lib/ruby/2.3.0/benchmark.rb:293:in `measure'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/command/action.rb:34:in `call'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/cli.rb:53:in `perform'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/cli.rb:187:in `block (2 levels) in <class:CLI>'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/cli.rb:334:in `invoke_task'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/bin/kitchen:13:in `block in <top (required)>'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/errors.rb:171:in `with_friendly_errors'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/bin/kitchen:13:in `<top (required)>'
D /opt/chefdk/bin/kitchen:21:in `load'
D /opt/chefdk/bin/kitchen:21:in `<main>'
D ----End Backtrace-----
D -Composite Exception--
D Class: Kitchen::ActionFailed
D Message: Failed to complete #converge action: [incompatible character encodings: UTF-8 and ASCII-8BIT] on default-windows2008r2
D ----------------------
D ------Backtrace-------
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/message_data/pipeline_output.rb:35:in `gsub'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/message_data/pipeline_output.rb:35:in `block in extract_out_string'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/message_data/pipeline_output.rb:32:in `map'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/message_data/pipeline_output.rb:32:in `extract_out_string'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/message_data/pipeline_output.rb:25:in `output'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/powershell_output_decoder.rb:51:in `decode_pipeline_output'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/powershell_output_decoder.rb:33:in `decode'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/receive_response_reader.rb:63:in `block (2 levels) in read_output'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/receive_response_reader.rb:45:in `block in read_message'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/wsmv/receive_response_reader.rb:66:in `block in read_response'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/wsmv/receive_response_reader.rb:121:in `block in read_streams'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/wsmv/receive_response_reader.rb:119:in `each'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/wsmv/receive_response_reader.rb:119:in `read_streams'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/wsmv/receive_response_reader.rb:65:in `read_response'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/receive_response_reader.rb:41:in `read_message'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/receive_response_reader.rb:60:in `block in read_output'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/wsmv/receive_response_reader.rb:75:in `with_output'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/receive_response_reader.rb:59:in `read_output'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/shells/base.rb:81:in `block in run'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/shells/base.rb:127:in `with_command_shell'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/shells/base.rb:80:in `run'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/transport/winrm.rb:218:in `execute_with_exit_code'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/transport/winrm.rb:100:in `execute'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/transport/base.rb:119:in `execute_with_retry'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/provisioner/base.rb:75:in `block in call'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/transport/base.rb:89:in `initialize'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/transport/winrm.rb:422:in `new'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/transport/winrm.rb:422:in `create_new_connection'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/transport/winrm.rb:74:in `connection'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/provisioner/base.rb:68:in `call'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:384:in `block in converge_action'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:527:in `synchronize_or_call'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:489:in `block in action'
D /opt/chefdk/embedded/lib/ruby/2.3.0/benchmark.rb:293:in `measure'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:488:in `action'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:380:in `converge_action'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:359:in `block in transition_to'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:358:in `each'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:358:in `transition_to'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:135:in `converge'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/command.rb:197:in `public_send'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/command.rb:197:in `run_action_in_thread'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/command.rb:169:in `block (2 levels) in run_action'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/logging-2.1.0/lib/logging/diagnostic_context.rb:450:in `block in create_with_logging_context'
D ----End Backtrace-----
D ---Nested Exception---
D Class: Kitchen::ActionFailed
D Message: Failed to complete #converge action: [incompatible character encodings: UTF-8 and ASCII-8BIT]
D ----------------------
D ------Backtrace-------
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/message_data/pipeline_output.rb:35:in `gsub'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/message_data/pipeline_output.rb:35:in `block in extract_out_string'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/message_data/pipeline_output.rb:32:in `map'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/message_data/pipeline_output.rb:32:in `extract_out_string'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/message_data/pipeline_output.rb:25:in `output'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/powershell_output_decoder.rb:51:in `decode_pipeline_output'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/powershell_output_decoder.rb:33:in `decode'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/receive_response_reader.rb:63:in `block (2 levels) in read_output'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/receive_response_reader.rb:45:in `block in read_message'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/wsmv/receive_response_reader.rb:66:in `block in read_response'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/wsmv/receive_response_reader.rb:121:in `block in read_streams'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/wsmv/receive_response_reader.rb:119:in `each'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/wsmv/receive_response_reader.rb:119:in `read_streams'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/wsmv/receive_response_reader.rb:65:in `read_response'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/receive_response_reader.rb:41:in `read_message'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/receive_response_reader.rb:60:in `block in read_output'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/wsmv/receive_response_reader.rb:75:in `with_output'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/psrp/receive_response_reader.rb:59:in `read_output'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/shells/base.rb:81:in `block in run'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/shells/base.rb:127:in `with_command_shell'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/shells/base.rb:80:in `run'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/transport/winrm.rb:218:in `execute_with_exit_code'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/transport/winrm.rb:100:in `execute'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/transport/base.rb:119:in `execute_with_retry'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/provisioner/base.rb:75:in `block in call'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/transport/base.rb:89:in `initialize'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/transport/winrm.rb:422:in `new'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/transport/winrm.rb:422:in `create_new_connection'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/transport/winrm.rb:74:in `connection'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/provisioner/base.rb:68:in `call'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:384:in `block in converge_action'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:527:in `synchronize_or_call'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:489:in `block in action'
D /opt/chefdk/embedded/lib/ruby/2.3.0/benchmark.rb:293:in `measure'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:488:in `action'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:380:in `converge_action'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:359:in `block in transition_to'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:358:in `each'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:358:in `transition_to'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:135:in `converge'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/command.rb:197:in `public_send'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/command.rb:197:in `run_action_in_thread'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/command.rb:169:in `block (2 levels) in run_action'
D /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/logging-2.1.0/lib/logging/diagnostic_context.rb:450:in `block in create_with_logging_context'
D ----End Backtrace-----
kitchen destroy && kitchen converge. Elevated: true
[WinRM] Established
Vagrant instance <default-windows2008r2> created.
Finished creating <default-windows2008r2> (3m34.20s).
-----> Converging <default-windows2008r2>...
Preparing files for transfer
Preparing dna.json
Resolving cookbook dependencies with Berkshelf 5.2.0...
Removing non-cookbook files before transfer
Preparing validation.pem
Preparing client.rb
-----> Installing Chef Omnibus (12.17.44)
Skipping package download; found a matching package at C:\omnibus\cache\chef-client-12.17.44-1-x64.msi
Installing Chef Omnibus package C:\omnibus\cache\chef-client-12.17.44-1-x64.msi
Installation complete
Transferring files to <default-windows2008r2>
Starting Chef Client, version 12.17.44
Creating a new client identity for default-windows2008r2 using the validator key.
resolving cookbooks for run list: ["gf_adds::test"]
Synchronizing Cookbooks:
- gf_adds (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 1 resources
Recipe: gf_adds::test
* windows_package[Ай-ти отдел] action install
Recipe: <Dynamically Defined Resource>
* remote_file[C:\Users\vagrant\AppData\Local\Temp\kitchen\cache\package\npp.7.Installer.exe] action create
- create new file C:\Users\vagrant\AppData\Local\Temp\kitchen\cache\package\npp.7.Installer.exe
- update content in file C:\Users\vagrant\AppData\Local\Temp\kitchen\cache\package\npp.7.Installer.exe from none to 0155c4
(diff output suppressed by config)
- install version latest of package Ай-ти отдел
Running handlers:
Running handlers complete
Chef Client finished, 2/2 resources updated in 40 seconds
Finished converging <default-windows2008r2> (3m30.85s).
BTW, the error comes with old version of elevated_shell.ps1 and with new version also.
ok https://github.com/WinRb/WinRM/pull/243 should fix the unelevated case. Technically it fixes the elevated case too, but this PR improves the UX by ensuring all output maintains its UTF-8ness and displays much better than the non elevted shell. See the PR comments in https://github.com/WinRb/WinRM/pull/243 for those details.
and I am reproing the appveyor failure on a 2016 VM.
Matt, how could i test winrm gem 2.1.1?
I have not released it yet but you could add the PR branch to a gemfile with
gem 'winrm', github: 'winrb/winrm', branch: 'utf'
I just release winrm 2.1.1 so you can test it via rubygems now @jugatsu
Latest commit fixed the integration test on 2016 but 2012R2 still busted.
Playing around today with an elevated shell (_latest version of elevatedshell.ps1) in TK i caught the bug with chocolatey installation using cookbook https://github.com/chocolatey/chocolatey-cookbook.
Encoding::UndefinedConversionError: "\xEF" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to UTF-16LE
I think this doesn't matter what to install, it can be chocolatey or other powershell script
Steps to reproduce: kitchen.yml: https://gist.github.com/jugatsu/2489bc10eb551952a35f3f27055b2945 test recipe:
chocolatey_package 'NSSM' do
version '2.24.0'
options '--allow-empty-checksums'
action :install
end
Or you can test without test recipe - just plain chocolatey install.
Result:
First time converged, second run:
[2016-12-20T11:30:34+03:00] FATAL: Encoding::UndefinedConversionError: powershell_script[Install Chocolatey] (chocolatey::default line 36) had an error: Encoding::UndefinedConversionError: "\xEF" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to UTF-16LE
kitchen converge -l debug: https://gist.github.com/jugatsu/6751b8221f4f45611073079cd567a866
chef -v Chef Development Kit Version: 1.1.16 chef-client version: 12.17.44 delivery version: master (83358fb62c0f711c70ad5a81030a6cae4017f103) berks version: 5.2.0 kitchen version: 1.14.2
chef gem list
*** LOCAL GEMS ***
winrm (2.1.1, 2.1.0)
winrm-elevated (1.1.0)
winrm-fs (1.0.1)
the error from choco does not look like its coming from winrm (at least I don't see it in the stacktrace). Can you run the recipie directly on the node locally and see if you get the same error?
Hmm... Can't reproduce at home using another Windows PosReady box. Maybe be vagrant box issue.
I will double-check tomorrow.
This is definitely strange issue. Similar issue https://github.com/chocolatey/chocolatey-cookbook/issues/92. I can reproduce this only on specific vagrant box. This box was crafted by hand, not packer ) On box that was build by packer it's completely fine.
But, i got stackstrace.out :) https://gist.github.com/jugatsu/cc5358c40ee5178b6aba405336e3c068
I also have 330 mb procmon dump)
I think i got the root cause of this issue. In some circumstances chocolatey_installed? https://github.com/chocolatey/chocolatey-cookbook/blob/master/libraries/helpers.rb#L28 shelling out choco.exe at this path http://imgur.com/a/UcRg1 I don't know how it happens )
It only happens when running with elevated: true With elevated:false path of choco.exe is C:\ProgramData\chocolatey\bin\choco.exe (dumped by procmon)
After succesfully converged with elevated: false. I immediately run with elevated: true and it converged succesfully too ))
Can't reproduce with the new box that was build by packer.
After hours of debugging i totally got it.
https://github.com/WinRb/winrm-elevated/blob/eadacf30b71a6f81dffe5bb34863a7f2d6619233/lib/winrm-elevated/scripts/elevated_shell.ps1#L61
This method of encoding produces UTF with BOM. As a result, chef-client running as elevated task on OS's with system locale, for example. ru-RU will be using UTF with BOM.
For example, path to choco.exe as per chocolatey provider https://github.com/chef/chef/blob/master/lib/chef/provider/package/chocolatey.rb#L153 would be
C:\п»їC:\ProgramData\chocolatey\bin\choco.exe
Byte Order Mark: п»ї
It totally breaks chcocolate_package resource
[2016-12-24T22:57:16+03:00] FATAL: Chef::Exceptions::MissingLibrary: chocolatey_package[procmon] (choco::default line 10) had an error: Chef::Exceptions::MissingLibrary: Could not locate your Chocolatey install. To install chocolatey, we recommend
the 'chocolatey' cookbook (https://github.com/chocolatey/chocolatey-cookbook).
If Chocolatey is installed, ensure that the 'ChocolateyInstall' environment
variable is correctly set. You can verify this with the PowerShell command
'[System.Environment]::GetEnvironmentVariable('ChocolateyInstall', 'MACHINE')'.
We should encode without BOM http://stackoverflow.com/questions/5596982/using-powershell-to-write-a-file-in-utf-8-without-the-bom
@mwrock what do you think about it?
When i run locally via
& $env:systemdrive\opscode\chef\bin\chef-client.bat --local-mode --config $env:TEMP\kitchen\client.rb --log_level auto --force-formatter --no-color --json-attributes $env:TEMP\kitchen\dna.json --chef-zero-port 8889
It works as expected
https://github.com/chef/chef/blob/master/lib/chef/provider/package/chocolatey.rb#L160 Add to test recipe
PATHFINDING_POWERSHELL_COMMAND = "[System.Environment]::GetEnvironmentVariable('ChocolateyInstall', 'MACHINE')"
result = powershell_out!(PATHFINDING_POWERSHELL_COMMAND).stdout.chomp
Chef::Log.warn("#{result}".stdout) # make chef fail
chocolatey_package 'procmon'
The result of chef-client run:
-----> Starting Kitchen (v1.14.2)
-----> Converging <default-windows-POSReady7>...
Preparing files for transfer
Preparing dna.json
Resolving cookbook dependencies with Berkshelf 5.2.0...
Removing non-cookbook files before transfer
Preparing validation.pem
Preparing client.rb
-----> Chef Omnibus installation detected (install only if missing)
Transferring files to <default-windows-POSReady7>
Starting Chef Client, version 12.17.44
resolving cookbooks for run list: ["choco::default"]
Synchronizing Cookbooks:
- choco (0.1.0)
- ohai (4.2.3)
- windows (2.1.1)
- chocolatey (1.0.3)
- compat_resource (12.16.3)
Installing Cookbook Gems:
Compiling Cookbooks...
================================================================================
Recipe Compile Error in C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/choco/recipes/default.rb
================================================================================
NoMethodError
-------------
undefined method `stdout' for "\xEF\xBB\xBFC:\\ProgramData\\chocolatey":String
Platform:
---------
i386-mingw32
Running handlers:
[2016-12-25T01:11:04+03:00] ERROR: Running exception handlers
Running handlers complete
[2016-12-25T01:11:04+03:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 32 seconds
[2016-12-25T01:11:04+03:00] FATAL: Stacktrace dumped to C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
[2016-12-25T01:11:04+03:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-12-25T01:11:04+03:00] FATAL: NoMethodError: undefined method `stdout' for "\xEF\xBB\xBFC:\\ProgramData\\chocolatey":String
ak@ak-pc:~/Dropbox/devops/labs/choco$ cat ~/.kitchen/cache/chef-stacktrace.out
Generated at 2016-12-25 01:11:04 +0300
NoMethodError: undefined method `stdout' for "\xEF\xBB\xBFC:\\ProgramData\\chocolatey":String
C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/choco/recipes/default.rb:11:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/mixin/from_file.rb:30:in `instance_eval'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/mixin/from_file.rb:30:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/cookbook_version.rb:233:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/run_context.rb:338:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:141:in `block in compile_recipes'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:138:in `each'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:138:in `compile_recipes'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:75:in `compile'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/run_context.rb:187:in `load'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/policy_builder/expand_node_object.rb:97:in `setup_run_context'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/client.rb:511:in `setup_run_context'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/client.rb:281:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application.rb:276:in `run_with_graceful_exit_option'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application.rb:252:in `block in run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/local_mode.rb:44:in `with_server_connectivity'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application.rb:235:in `run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application/client.rb:427:in `run_application'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application.rb:59:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/bin/chef-client:26:in `<top (required)>'
C:/opscode/chef/bin/chef-client:68:in `load'
C:/opscode/chef/bin/chef-client:68:in `<main>'ak@ak-pc:~/Dropbox/devops/labs/choco$
@jugatsu what version of winrm-elevated are you using now? The latest release or this PR?
@mwrock This PR.
It works as expected when using master branch. And so with elevated:false Also after successfully converged with elevated:false, next run with elevated: true works as expected.
I add stdout to result var to make chef fail in compile phase (see above). My test recipe
PATHFINDING_POWERSHELL_COMMAND = "[System.Environment]::GetEnvironmentVariable('ChocolateyInstall', 'MACHINE')"
result = powershell_out!(PATHFINDING_POWERSHELL_COMMAND).stdout.chomp
Chef::Log.warn("#{result}".stdout) # make chef fail
NoMethodError
-------------
undefined method `stdout' for "\xEF\xBB\xBFC:\\ProgramData\\chocolatey":String
but next run with elevated:true after successfully elevated:false
undefined method `stdout' for "C:\\ProgramData\\chocolatey":String
So it works.
I think the issue exactly with powershell_out running from elevated shell. Looks like UTF BOM.
Yeah it seems like things work on master and I'm not intending to move forward with this PR. The downside with master is that encoding issues can cause output to appear garbled but it seems to be just an output issue. The fact is that the behavior matches the same behavior you would see with native powershell remoting which is the bar we are trying to meet.
I will stick with master, don't bother about output issues.
Closing but thanks a ton @jugatsu for testing and repro details!
Reported via https://github.com/test-kitchen/test-kitchen/issues/1170
Just need to validate this does not break powershell v2