NetDocuments-Archive / rd-winrm-plugin

Allows rundeck to execute commands with powershell
Apache License 2.0
30 stars 19 forks source link

Error can't modify frozen string #2

Closed dscowan closed 9 years ago

dscowan commented 9 years ago
15:07:17    localhost       [workflow] Begin execution: rundeck-workflow-node-first context: null
15:07:17            preparing for sequential execution on 1 nodes
15:07:17            Executing command on node: WinChef04, NodeEntryImpl{tags=[], attributes={tags=, osFamily=windows, username=Administrator, osVersion=6.3.9600, osArch=x64, winrmuser=Administrator, winrmhost=WinChef04, description=WinChef04, winrmpass=test, hostname=WinChef04, nodename=WinChef04, osName=Windows Server 2012R2}, project='null'}
15:07:17            NodeSet: MultiNodeSelector{nodenames=[WinChef04]}
15:07:17            Workflow: com.dtolabs.rundeck.core.execution.workflow.StepFirstWorkflowStrategy$stepFirstWrapper@ee34a9f2
15:07:17            data context:  {node={tags=, username=Administrator, winrmuser=Administrator, os-version=6.3.9600, winrmhost=WinChef04, description=WinChef04, name=WinChef04, os-arch=x64, winrmpass=***, hostname=WinChef04, os-name=Windows Server 2012R2, os-family=windows}, job={loglevel=DEBUG, wasRetry=false, url=http://192.169.2.76:4440/project/WindowsTest/execution/follow/66, id=f16d7384-c146-42b6-b4af-170ece45b257, project=WindowsTest, username=admin, retryAttempt=0, user.name=admin, name=Test1234, serverUUID=null, group=null, execid=66, serverUrl=http://192.169.2.76:4440/}, option={}}
15:07:17         1. Script  [workflow] Begin step: 1,NodeDispatch
15:07:17            1: Workflow step executing: com.dtolabs.rundeck.execution.ExecutionItemFactory$1@531aa055
15:07:17            preparing for sequential execution on 1 nodes
15:07:17            Executing command on node: WinChef04, NodeEntryImpl{tags=[], attributes={tags=, osFamily=windows, username=Administrator, osVersion=6.3.9600, osArch=x64, winrmuser=Administrator, winrmhost=WinChef04, description=WinChef04, winrmpass=test, hostname=WinChef04, nodename=WinChef04, osName=Windows Server 2012R2}, project='null'}
15:07:17    WinChef04    1. Script  [workflow] beginExecuteNodeStep(WinChef04): NodeDispatch: com.dtolabs.rundeck.execution.ExecutionItemFactory$1@531aa055
15:07:17            [WinRMcp] executing: [ruby, /var/lib/rundeck/libext/cache/rd-winrm-plugin-1.3.0/winrmcp.rb, ${node.hostname}, /var/lib/rundeck/var/tmp/dispatch6393528670001061757.tmp, C:\WINDOWS\TEMP\22-66-WinChef04-dispatch-script.tmp.bat]
15:07:17            /var/lib/gems/1.9.1/gems/rubyntlm-0.4.0/lib/net/ntlm/encode_util.rb:42:in `force_encoding': can't modify frozen String (RuntimeError)
15:07:17                from /var/lib/gems/1.9.1/gems/rubyntlm-0.4.0/lib/net/ntlm/encode_util.rb:42:in `encode_utf16le'
15:07:17                from /var/lib/gems/1.9.1/gems/rubyntlm-0.4.0/lib/net/ntlm/message/type2.rb:82:in `response'
15:07:17                from /var/lib/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient/auth.rb:563:in `block in get'
15:07:17                from <internal:prelude>:10:in `synchronize'
15:07:17                from /usr/lib/ruby/1.9.1/mutex_m.rb:62:in `mu_synchronize'
15:07:17                from /var/lib/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient/auth.rb:537:in `get'
15:07:17                from /var/lib/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient/auth.rb:97:in `block in filter_request'
spuder commented 9 years ago

Can you provide more information like: what version? how installed? steps to reproduce?

dscowan commented 9 years ago

Rundeck version 2.5.3-1 winrm plugin version 1.3.0 Running on ubuntu To install I followed the directions. Only difference being the download file was 1.3.0.zip so I renamed it to rd-winrm-plugin-1.3.0.zip

Using plaintext auth with no kerberos

I created a job with an inline script with only one command: "dir"

When I run the job I pick one node. I am not doing any overrides

spuder commented 9 years ago

Thanks @vvchik can you take a look?

vvchik commented 9 years ago

Unable to reproduce on my ENV may you please add ".dup" to end of line 4 in winrmcp.rb (should be similar to line 5)
user = ENV['RD_CONFIG_USER'].dup
pass = ENV['RD_CONFIG_PASS'].dup

one more thing, are you able to run not script but command inside of job?

dscowan commented 9 years ago

I tried this. Not sure if I did it correctly but edited

:/var/lib/rundeck/libext/cache/rd-winrm-plugin-1.3.0/winrmcp.rb as described above and still get the same error. Also tried adding .dup to the host variable but get the same error

Just running a command I get a similar error but it is from winrmexe.rb instead

[WinRMexe] executing: [[ruby, /var/lib/rundeck/libext/cache/rd-winrm-plugin-1.3.0/winrmexe.rb]]
10:23:28            /var/lib/gems/1.9.1/gems/rubyntlm-0.4.0/lib/net/ntlm/encode_util.rb:42:in `force_encoding': can't modify frozen String (RuntimeError)
10:23:28                from /var/lib/gems/1.9.1/gems/rubyntlm-0.4.0/lib/net/ntlm/encode_util.rb:42:in `encode_utf16le'
10:23:28                from /var/lib/gems/1.9.1/gems/rubyntlm-0.4.0/lib/net/ntlm/message/type2.rb:82:in `response'
10:23:28                from /var/lib/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient/auth.rb:563:in `block in get'
10:23:28                from <internal:prelude>:10:in `synchronize'
10:23:28                from /usr/lib/ruby/1.9.1/mutex_m.rb:62:in `mu_synchronize'
10:23:28                from /var/lib/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient/auth.rb:537:in `get'
10:23:28                from /var/lib/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient/auth.rb:97:in `block in filter_request'
10:23:28                from /var/lib/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient/auth.rb:95:in `each'
10:23:28                from /var/lib/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient/auth.rb:95:in `filter_request'
10:23:28                from /var/lib/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient.rb:1180:in `block in do_get_block'
10:23:28                from /var/lib/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient.rb:1179:in `each'
10:23:28                from /var/lib/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient.rb:1179:in `do_get_block'
10:23:28                from /var/lib/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient.rb:974:in `block in do_request'
10:23:28                from /var/lib/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient.rb:1082:in `protect_keep_alive_disconnected'
10:23:28                from /var/lib/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient.rb:969:in `do_request'
10:23:28                from /var/lib/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient.rb:822:in `request'
10:23:28                from /var/lib/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient.rb:725:in `post'
10:23:28                from /var/lib/gems/1.9.1/gems/winrm-1.3.4/lib/winrm/http/transport.rb:47:in `send_request'
10:23:28                from /var/lib/gems/1.9.1/gems/winrm-1.3.4/lib/winrm/winrm_service.rb:430:in `send_message'
10:23:28                from /var/lib/gems/1.9.1/gems/winrm-1.3.4/lib/winrm/winrm_service.rb:126:in `open_shell'
10:23:28                from /var/lib/gems/1.9.1/gems/winrm-1.3.4/lib/winrm/winrm_service.rb:299:in `run_cmd'
10:23:28                from /var/lib/gems/1.9.1/gems/winrm-1.3.4/lib/winrm/winrm_service.rb:317:in `run_powershell_script'
10:23:28                from /var/lib/rundeck/libext/cache/rd-winrm-plugin-1.3.0/winrmexe.rb:101:in `<main>'
dscowan commented 9 years ago

Ok I got this working. Adding a dup on user = ENV['RD_CONFIG_USER'].dup did work. Not sure why it didn't before. I was editing the cached versions directly, maybe they did not reload

vvchik commented 9 years ago

ok, thank you, I will fix it in next version.