NetDocuments-Archive / rd-winrm-plugin

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

help! in `sub': invalid byte sequence in UTF-8 #10

Closed oslet closed 8 years ago

oslet commented 8 years ago

env: os: centos 6.5 x86_64 ruby: 2.1.2 winrm: 1.4.0 winrm-fs: 0.2.3

my pro settings:

project.description=rd-winrm project.name=win2 project.plugin.FileCopier.WinRMcp.allowoverride=none project.plugin.FileCopier.WinRMcp.authtype=plaintext project.plugin.FileCopier.WinRMcp.pass= project.plugin.FileCopier.WinRMcp.shell=cmd project.plugin.FileCopier.WinRMcp.user=Administrator project.plugin.FileCopier.WinRMcp.winrmport=5985 project.plugin.FileCopier.WinRMcp.winrmtimeout=60 project.plugin.NodeExecutor.WinRMexe.allowoverride=none project.plugin.NodeExecutor.WinRMexe.authtype=plaintext project.plugin.NodeExecutor.WinRMexe.pass= project.plugin.NodeExecutor.WinRMexe.shell=cmd project.plugin.NodeExecutor.WinRMexe.user=Administrator project.plugin.NodeExecutor.WinRMexe.winrmport=5985 project.plugin.NodeExecutor.WinRMexe.winrmtimeout=60 project.ssh-authentication=privateKey project.ssh-keypath=/var/lib/rundeck/.ssh/id_rsa resources.source.1.config.file=/var/rundeck/projects/win2/etc/resources.xml resources.source.1.config.format=resourcexml resources.source.1.config.generateFileAutomatically=true resources.source.1.config.includeServerNode=true resources.source.1.config.requireFileExists=false resources.source.1.type=file service.FileCopier.default.provider=WinRMcp service.NodeExecutor.default.provider=WinRMexe

I can run this job, but result is:

/usr/lib64/ruby/gems/2.1.0/gems/winrm-1.4.0/lib/winrm/winrm_service.rb:237:in sub': invalid byte sequence in UTF-8 (ArgumentError) from /usr/lib64/ruby/gems/2.1.0/gems/winrm-1.4.0/lib/winrm/winrm_service.rb:237:inblock in get_command_output' from /usr/lib64/ruby/gems/2.1.0/gems/winrm-1.4.0/lib/winrm/winrm_service.rb:233:in each' from /usr/lib64/ruby/gems/2.1.0/gems/winrm-1.4.0/lib/winrm/winrm_service.rb:233:inget_command_output' from /usr/lib64/ruby/gems/2.1.0/gems/winrm-1.4.0/lib/winrm/winrm_service.rb:303:in block (2 levels) in run_cmd' from /usr/lib64/ruby/gems/2.1.0/gems/winrm-1.4.0/lib/winrm/winrm_service.rb:174:inrun_command' from /usr/lib64/ruby/gems/2.1.0/gems/winrm-1.4.0/lib/winrm/winrm_service.rb:302:in block in run_cmd' from /usr/lib64/ruby/gems/2.1.0/gems/winrm-1.4.0/lib/winrm/winrm_service.rb:301:inrun_cmd' from /var/lib/rundeck/libext/cache/rd-winrm-plugin-1.3.2/winrmexe.rb:107:in `

'

Please help me

spuder commented 8 years ago

@vvchik Any idea what is going on here?

vvchik commented 8 years ago

We are using Ubuntu for our rundeck installation. I need to check with RH (may be at weekend)
but also it can be connected to some output that come from windows. @oslet may you give me your command? Are you tried to run commands from troubleshooting section?

oslet commented 8 years ago

I just run command ok, such as netstat -ant, but ipconfig is not work It may be the reason that the characters are not supported The client os: winserver2012 r2 x64 zh-cn

success: @echo off netstat -ant

failed: @echo off ipconfig

ipconfig execution output bear with Chinese characters.

could you help me ?

vvchik commented 8 years ago

Oh, Chinese characters. I will try, but how are you usually work with similar cases, character encoding and so?

oslet commented 8 years ago

I use rundeck to deploy .net apps, use batch file to start/stop website, recycling pools etc.

vvchik commented 8 years ago

are you using CMD for run your script? may you try powershell?

oslet commented 8 years ago

yes, not a good experience with a batch I use ps, The Chinese characters output very well

example:

!Powershell

get-service

The output: Running W32Time Windows Time
Stopped W3LOGSVC W3C 日志记录服务
Running W3SVC World Wide Web Publishing Service
Running WAS Windows Process Activation Service

vvchik commented 8 years ago

Well it is CMD limitations nor plugin. Closed