Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

TypeError when running multiple 'winrm cmd' commands #3

Open
sysadmin1139 opened this issue Sep 27, 2011 · 1 comment
Open

TypeError when running multiple 'winrm cmd' commands #3

sysadmin1139 opened this issue Sep 27, 2011 · 1 comment

Comments

@sysadmin1139
Copy link

I've run into an issue where running multiple winrm cmd commands will eventually trigger a TypeError in winrm-1.0.4/lib/winrm/http/transport.rb:141. Specifically, the third invocation will trigger it. The sample task:

    set :winrm_krb5_realm, 'OURS.LOCAL'
    namespace :windows_worker do

    desc 'Test task to expose fault'
    task :testbug, :roles => :windows_worker do

       command = []
       command << 'echo This is the first run'
       command << 'echo This is the second run'
       command << 'echo This is the third run'

       command.each do |cmd|
       winrm cmd do |channel, stream, data|
         puts "#{channel} - #{stream} - #{data}"
       end #winrm
    end #task

When executed against a single server, it'll error out on the third command. When run against two, it'll error out on the second line on the second server. The error:

winrm-1.0.4/lib/winrm/http/transport.rb:141:in `+': can't convert nil into String (TypeError)
from /winrm-1.0.4/lib/winrm/http/transport.rb:141:in `winrm_encrypt'
from /winrm-1.0.4/lib/winrm/http/transport.rb:80:in `send_request'
from /winrm-1.0.4/lib/winrm/winrm_service.rb:333:in `send_message'
from /winrm-1.0.4/lib/winrm/winrm_service.rb:180:in `cleanup_command'
from /winrm-1.0.4/lib/winrm/winrm_service.rb:224:in `run_cmd'
from /capistrano_winrm-1.0.0/lib/winrm_connection.rb:27:in `exec'
from /capistrano-2.8.0/lib/capistrano/command.rb:222:in `block (4 levels) in open_channels'
from /capistrano-2.8.0/lib/capistrano/command.rb:259:in `request_pty_if_necessary'
from /capistrano-2.8.0/lib/capistrano/command.rb:206:in `block (3 levels) in open_channels'
from /capistrano_winrm-1.0.0/lib/winrm_connection.rb:23:in `open_channel'
from /capistrano-2.8.0/lib/capistrano/command.rb:200:in `block (2 levels) in open_channels'
from /capistrano-2.8.0/lib/capistrano/command.rb:199:in `map'
from /capistrano-2.8.0/lib/capistrano/command.rb:199:in `block in open_channels'
from /capistrano-2.8.0/lib/capistrano/command.rb:197:in `map'
from /capistrano-2.8.0/lib/capistrano/command.rb:197:in `open_channels'
from /capistrano-2.8.0/lib/capistrano/command.rb:156:in `initialize'
from /capistrano-2.8.0/lib/capistrano/command.rb:134:in `new'
from /capistrano-2.8.0/lib/capistrano/command.rb:134:in `process'
from /capistrano-2.8.0/lib/capistrano/configuration/actions/invocation.rb:178:in `block in run_tree'
from /capistrano-2.8.0/lib/capistrano/configuration/connections.rb:198:in `block in execute_on_servers'
from /capistrano-2.8.0/lib/capistrano/configuration/connections.rb:186:in `each'
from /capistrano-2.8.0/lib/capistrano/configuration/connections.rb:186:in `each_slice'
from /capistrano-2.8.0/lib/capistrano/configuration/connections.rb:186:in `execute_on_servers'
from /capistrano-2.8.0/lib/capistrano/configuration/actions/invocation.rb:176:in `run_tree'
from /capistrano_winrm-1.0.0/lib/capistrano_winrm.rb:11:in `winrm_run'
from /capistrano-2.8.0/lib/capistrano/configuration/namespaces.rb:186:in `method_missing'
from /testtask.rb:199:in `block (3 levels) in load'
from /testtask.rb:198:in `each'
from /testtask.rb:198:in `block (2 levels) in load'
from /capistrano-2.8.0/lib/capistrano/configuration/execution.rb:139:in `instance_eval'
from /capistrano-2.8.0/lib/capistrano/configuration/execution.rb:139:in `invoke_task_directly'
from /capistrano-2.8.0/lib/capistrano/configuration/callbacks.rb:27:in `invoke_task_directly_with_callbacks'
from /capistrano-2.8.0/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /capistrano-2.8.0/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
from /capistrano-2.8.0/lib/capistrano/cli/execute.rb:46:in `block in execute_requested_actions'
from /capistrano-2.8.0/lib/capistrano/cli/execute.rb:45:in `each'
from /capistrano-2.8.0/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions'
from /capistrano-2.8.0/lib/capistrano/cli/help.rb:19:in `execute_requested_actions_with_help'
from /capistrano-2.8.0/lib/capistrano/cli/execute.rb:34:in `execute!'
from /capistrano-2.8.0/lib/capistrano/cli/execute.rb:14:in `execute'
from /capistrano-2.8.0/bin/cap:4:in `<top (required)>'

It seems like something in capistrano_winrm is getting something confused, since I can create a file using the winrm gem directly and can do the same commands with no errors.

@pmorton
Copy link

pmorton commented Feb 18, 2012

+1 In debugging on Lion with Hiemdal fully initialized, iov0[:buffer].value is nil.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants