Closed dscowan closed 8 years ago
Looks strange, also unable to reproduce.
do you have same configuration on node executor and file copier?
May you please turn on debug and show us full output?
Using rundeck 2.5.3-1 on ubuntu. Remote machin is windows server 2012 R2.
Here are my settings
project.plugin.FileCopier.WinRMcp.allowoverride=all project.plugin.FileCopier.WinRMcp.authtype=plaintext project.plugin.FileCopier.WinRMcp.pass=* project.plugin.FileCopier.WinRMcp.shell=powershell project.plugin.FileCopier.WinRMcp.user=Administrator project.plugin.FileCopier.WinRMcp.winrmport=5985 project.plugin.FileCopier.WinRMcp.winrmtimeout=600 project.plugin.NodeExecutor.WinRMexe.allowoverride=all project.plugin.NodeExecutor.WinRMexe.authtype=plaintext project.plugin.NodeExecutor.WinRMexe.pass= project.plugin.NodeExecutor.WinRMexe.shell=powershell project.plugin.NodeExecutor.WinRMexe.user=Administrator project.plugin.NodeExecutor.WinRMexe.winrmport=5985 project.plugin.NodeExecutor.WinRMexe.winrmtimeout=600
I have an inline script with one command "Get-Process" a powershell command.
07:42:33 localhost [workflow] Begin execution: rundeck-workflow-node-first context: null
07:42:33 preparing for sequential execution on 1 nodes
07:42:33 Executing command on node: ChefWorkStn01, NodeEntryImpl{tags=[], attributes={tags=, osFamily=windows, osVersion=6.3.9600, osArch=x64, description=ChefWorkStn01, hostname=ChefWorkStn01, nodename=ChefWorkStn01, osName=Windows Server 2012R2}, project='null'}
07:42:33 NodeSet: MultiNodeSelector{nodenames=[ChefWorkStn01]}
07:42:33 Workflow: com.dtolabs.rundeck.core.execution.workflow.StepFirstWorkflowStrategy$stepFirstWrapper@ef628220
07:42:33 data context: {node={tags=, username=, os-version=6.3.9600, description=ChefWorkStn01, name=ChefWorkStn01, os-arch=x64, hostname=ChefWorkStn01, os-name=Windows Server 2012R2, os-family=windows}, job={loglevel=DEBUG, wasRetry=false, url=http://192.169.2.76:4440/project/WindowsTest/execution/follow/102, id=f16d7384-c146-42b6-b4af-170ece45b257, project=WindowsTest, username=admin, retryAttempt=0, user.name=admin, name=Test1234, serverUUID=null, group=null, execid=102, serverUrl=http://192.169.2.76:4440/}, option={exec.dir=c:\chef\chef-repo}}
07:42:33 1. Script [workflow] Begin step: 1,NodeDispatch
07:42:33 1: Workflow step executing: com.dtolabs.rundeck.execution.ExecutionItemFactory$1@247166e7
07:42:33 preparing for sequential execution on 1 nodes
07:42:33 Executing command on node: ChefWorkStn01, NodeEntryImpl{tags=[], attributes={tags=, osFamily=windows, osVersion=6.3.9600, osArch=x64, description=ChefWorkStn01, hostname=ChefWorkStn01, nodename=ChefWorkStn01, osName=Windows Server 2012R2}, project='null'}
07:42:33 ChefWorkStn01 1. Script [workflow] beginExecuteNodeStep(ChefWorkStn01): NodeDispatch: com.dtolabs.rundeck.execution.ExecutionItemFactory$1@247166e7
07:42:33 [WinRMcp] executing: [ruby, /var/lib/rundeck/libext/cache/rd-winrm-plugin-1.3.0/winrmcp.rb, ${node.hostname}, /var/lib/rundeck/var/tmp/dispatch2431585967334258755.tmp, C:\WINDOWS\TEMP\47-102-ChefWorkStn01-dispatch-script.tmp.bat]
07:42:34 [WinRMcp]: result code: 0
07:42:34 [WinRMexe] execCommand started, command: C:\WINDOWS\TEMP\47-102-ChefWorkStn01-dispatch-script.tmp.bat
07:42:34 [WinRMexe] executing: [[ruby, /var/lib/rundeck/libext/cache/rd-winrm-plugin-1.3.0/winrmexe.rb]]
07:42:34 /var/lib/rundeck/libext/cache/rd-winrm-plugin-1.3.0/winrmexe.rb:79:in `stderr_text': undefined method `get_elements' for nil:NilClass (NoMethodError)
07:42:34 from /var/lib/rundeck/libext/cache/rd-winrm-plugin-1.3.0/winrmexe.rb:113:in `<main>'
07:42:34 variables:
07:42:34 realm =>
07:42:34 endpoint => http://ChefWorkStn01:5985/wsman
07:42:34 user => Administrator
07:42:34 pass => ********
07:42:34 command => C:\WINDOWS\TEMP\47-102-ChefWorkStn01-dispatch-script.tmp.bat
07:42:34 newcommand => C:\WINDOWS\TEMP\47-102-ChefWorkStn01-dispatch-script.tmp.bat
07:42:34
07:42:34 ENV:
07:42:34 RD_JOB_URL => http://192.169.2.76:4440/project/WindowsTest/execution/follow/102
07:42:34 RD_EXEC_COMMAND => C:\WINDOWS\TEMP\47-102-ChefWorkStn01-dispatch-script.tmp.bat
07:42:34 RD_NODE_DESCRIPTION => ChefWorkStn01
07:42:34 RD_CONFIG_WINRMPORT => 5985
07:42:34 RD_JOB_ID => f16d7384-c146-42b6-b4af-170ece45b257
07:42:34 RD_JOB_EXECID => 102
07:42:34 RD_JOB_RETRYATTEMPT => 0
07:42:34 RD_NODE_TAGS =>
07:42:34 RD_PLUGIN_FILE => /var/lib/rundeck/libext/rd-winrm-plugin-1.3.0.zip
07:42:34 RD_JOB_USER_NAME => admin
07:42:34 RD_JOB_LOGLEVEL => DEBUG
07:42:34 RD_NODE_OS_VERSION => 6.3.9600
07:42:34 RD_NODE_USERNAME =>
07:42:34 RD_CONFIG_ALLOWOVERRIDE => all
07:42:34 RD_JOB_USERNAME => admin
07:42:34 RD_CONFIG_WINRMTIMEOUT => 600
07:42:34 RD_PLUGIN_SCRIPTFILE => /var/lib/rundeck/libext/cache/rd-winrm-plugin-1.3.0/winrmexe.rb
07:42:34 RD_PLUGIN_TMPDIR => /var/lib/rundeck/var/tmp
07:42:34 RD_CONFIG_USER => Administrator
07:42:34 RD_CONFIG_SHELL => powershell
07:42:34 RD_NODE_OS_ARCH => x64
07:42:34 RD_JOB_NAME => Test1234
07:42:34 RD_JOB_WASRETRY => false
07:42:34 RD_CONFIG_AUTHTYPE => plaintext
07:42:34 RD_NODE_HOSTNAME => ChefWorkStn01
07:42:34 RD_JOB_SERVERURL => http://192.169.2.76:4440/
07:42:34 RD_PLUGIN_VARDIR => /var/rundeck/projects/WindowsTest/var
07:42:34 RD_JOB_PROJECT => WindowsTest
07:42:34 RD_NODE_NAME => ChefWorkStn01
07:42:34 RD_CONFIG_PASS => ********
07:42:34 RD_NODE_OS_FAMILY => windows
07:42:34 RD_NODE_OS_NAME => Windows Server 2012R2
07:42:34 RD_RUNDECK_BASE => /var/lib/rundeck
07:42:34 RD_RUNDECK_PROJECT => WindowsTest
07:42:34 RD_PLUGIN_BASE => /var/lib/rundeck/libext/cache/rd-winrm-plugin-1.3.0
07:42:34 RD_OPTION_EXEC_DIR => c:\chef\chef-repo
07:42:34 [WinRMexe]: result code: 1, success: false
07:42:34 [WinRMexe] execCommand started, command: del C:\WINDOWS\TEMP\47-102-ChefWorkStn01-dispatch-script.tmp.bat
07:42:34 [WinRMexe] executing: [[ruby, /var/lib/rundeck/libext/cache/rd-winrm-plugin-1.3.0/winrmexe.rb]]
07:42:35 variables:
07:42:35 realm =>
07:42:35 endpoint => http://ChefWorkStn01:5985/wsman
07:42:35 user => Administrator
07:42:35 pass => ********
07:42:35 command => del C:\WINDOWS\TEMP\47-102-ChefWorkStn01-dispatch-script.tmp.bat
07:42:35 newcommand => del C:\WINDOWS\TEMP\47-102-ChefWorkStn01-dispatch-script.tmp.bat
07:42:35
07:42:35 ENV:
07:42:35 RD_JOB_URL => http://192.169.2.76:4440/project/WindowsTest/execution/follow/102
07:42:35 RD_EXEC_COMMAND => del C:\WINDOWS\TEMP\47-102-ChefWorkStn01-dispatch-script.tmp.bat
07:42:35 RD_NODE_DESCRIPTION => ChefWorkStn01
07:42:35 RD_CONFIG_WINRMPORT => 5985
07:42:35 RD_JOB_ID => f16d7384-c146-42b6-b4af-170ece45b257
07:42:35 RD_JOB_EXECID => 102
07:42:35 RD_JOB_RETRYATTEMPT => 0
07:42:35 RD_NODE_TAGS =>
07:42:35 RD_PLUGIN_FILE => /var/lib/rundeck/libext/rd-winrm-plugin-1.3.0.zip
07:42:35 RD_JOB_USER_NAME => admin
07:42:35 RD_JOB_LOGLEVEL => DEBUG
07:42:35 RD_NODE_OS_VERSION => 6.3.9600
07:42:35 RD_NODE_USERNAME =>
07:42:35 RD_CONFIG_ALLOWOVERRIDE => all
07:42:35 RD_JOB_USERNAME => admin
07:42:35 RD_CONFIG_WINRMTIMEOUT => 600
07:42:35 RD_PLUGIN_SCRIPTFILE => /var/lib/rundeck/libext/cache/rd-winrm-plugin-1.3.0/winrmexe.rb
07:42:35 RD_PLUGIN_TMPDIR => /var/lib/rundeck/var/tmp
07:42:35 RD_CONFIG_USER => Administrator
07:42:35 RD_CONFIG_SHELL => powershell
07:42:35 RD_NODE_OS_ARCH => x64
07:42:35 RD_JOB_NAME => Test1234
07:42:35 RD_JOB_WASRETRY => false
07:42:35 RD_CONFIG_AUTHTYPE => plaintext
07:42:35 RD_NODE_HOSTNAME => ChefWorkStn01
07:42:35 RD_JOB_SERVERURL => http://192.169.2.76:4440/
07:42:35 RD_PLUGIN_VARDIR => /var/rundeck/projects/WindowsTest/var
07:42:35 RD_JOB_PROJECT => WindowsTest
07:42:35 RD_NODE_NAME => ChefWorkStn01
07:42:35 RD_CONFIG_PASS => ********
07:42:35 RD_NODE_OS_FAMILY => windows
07:42:35 RD_NODE_OS_NAME => Windows Server 2012R2
07:42:35 RD_RUNDECK_BASE => /var/lib/rundeck
07:42:35 RD_RUNDECK_PROJECT => WindowsTest
07:42:35 RD_PLUGIN_BASE => /var/lib/rundeck/libext/cache/rd-winrm-plugin-1.3.0
07:42:35 RD_OPTION_EXEC_DIR => c:\chef\chef-repo
07:42:35 [WinRMexe]: result code: 0, success: true
07:42:35 Failed: NonZeroResultCode: [WinRMexe] Result code: 1
07:42:35 localhost 1. Script [workflow] finishExecuteNodeStep(ChefWorkStn01): NodeDispatch: NonZeroResultCode: [WinRMexe] Result code: 1
07:42:35 1: Workflow step finished, result: Dispatch failed on 1 nodes: [ChefWorkStn01: NonZeroResultCode: [WinRMexe] Result code: 1]
07:42:35 [workflow] Finish step: 1,NodeDispatch
07:42:35 [workflow] Finish execution: rundeck-workflow-node-first: [Workflow result: , step failures: {1=Dispatch failed on 1 nodes: [ChefWorkStn01: NonZeroResultCode: [WinRMexe] Result code: 1]}, Node failures: {ChefWorkStn01=[NonZeroResultCode: [WinRMexe] Result code: 1]}, flow control: Continue, status: failed]
07:42:35 [Workflow result: , step failures: {1=Dispatch failed on 1 nodes: [ChefWorkStn01: NonZeroResultCode: [WinRMexe] Result code: 1]}, Node failures: {ChefWorkStn01=[NonZeroResultCode: [WinRMexe] Result code: 1]}, flow control: Continue, status: failed]
07:42:35 Execution failed: 102: [Workflow result: , step failures: {1=Dispatch failed on 1 nodes: [ChefWorkStn01: NonZeroResultCode: [WinRMexe] Result code: 1]}, Node failures: {ChefWorkStn01=[NonZeroResultCode: [WinRMexe] Result code: 1]}, flow control: Continue, status: failed]
Please check: edit job -> edit script -> advanced -> File Extension That field should be leaved blank or have "ps1" value
The field was blank. When I changed to to ps1 then it worked as expected. Changing it back to blank and it failed once again using .bat
may you send me job xml to my email (it is available on my profile)
Here it is
<joblist>
<job>
<id>f16d7384-c146-42b6-b4af-170ece45b257</id>
<loglevel>DEBUG</loglevel>
<sequence keepgoing='false' strategy='node-first'>
<command>
<scriptargs />
<script><![CDATA[Get-Process]]></script>
</command>
</sequence>
<description></description>
<name>Test1234</name>
<context>
<project>WindowsTest</project>
</context>
<dispatch>
<threadcount>1</threadcount>
<keepgoing>false</keepgoing>
<excludePrecedence>true</excludePrecedence>
<rankOrder>ascending</rankOrder>
</dispatch>
<uuid>f16d7384-c146-42b6-b4af-170ece45b257</uuid>
<nodefilters>
<filter>name: ChefWorkStn01</filter>
</nodefilters>
</job>
</joblist>
Well, to be true, I make some hack because of behavior that I have in my case (script always have ".sh" extension)
And in plugin I am changing ".sh" to "ps1" or "bat" based on chosen executor.
But in your case it behave as documented, so please use behavior explaned in rundeck/rundeck#950
Add a "File extension" field to set the extension on the copied script file before it is executed.
If unset, will use previous node osFamily based defaults (".sh" for unix, ".bat" for windows).
I not sure is I have to fix that.
I would think the plugin would default to what is set in the configuration for the plugin which in my case is powershell, unless overridden in the script itself.
All my nodes have osFamily: winnt
and osName: windows
because chef-rundeck return it in this style. But code inside of rundeck expect to have osFamily: window
" here and I don't know who is wrong in this situation.
But anyway I unable to catch edit job -> edit script -> advanced -> File Extension
value and don't want to broke existing behavior if some user want to use his own extension.
I guess to remove code that replacing ".sh" to ".ps1" in future versions, and reflect File Extension
usage requirement in documentation.
Yeah I would think that would be sufficient. Something in the docs calling it out would be helpful.