PyWinRM can't copy file from Linux Rundeck machine to Windows machine

149 views
Skip to first unread message

David Albuquerque

unread,
Sep 25, 2024, 7:36:52 AM9/25/24
to rundeck-discuss
Hi! I have a simple job where I'm trying to copy an uploaded file to a Windows machine. I got the job definition example from another forum post. Although everything looks OK, I keep getting the error: 

Begin copy 1734 bytes to node mymachinename: /var/lib/rundeck/var/upload/aa779fa7-4238-4d8c-bf4b-15f1d424c21c -> C:\INTEGRATIONS_APP\DEV\teste-ficheiro-rdm/teste.log
  File "/var/lib/rundeck/libext/cache/py-winrm-plugin-2.1.3/winrm-filecopier.py", line 103
    http.client.print = httpclient_log
                    ^
SyntaxError: invalid syntax
failed: [WinRMcpPython]: external script failed with exit code: 1
Failed: CopyFileFailed: com.dtolabs.rundeck.core.execution.service.FileCopierException: [WinRMcpPython]: external script failed with exit code: 1
Execution failed: 5851655 in project OSS_Team: [Workflow result: , step failures: {1=Dispatch failed on 1 nodes: [mymachinename: CopyFileFailed: com.dtolabs.rundeck.core.execution.service.FileCopierException: [WinRMcpPython]: external script failed with exit code: 1 + {dataContext=MultiDataContextImpl(map={}, base=null)} ]}, Node failures: {mymachinename=[CopyFileFailed: com.dtolabs.rundeck.core.execution.service.FileCopierException: [WinRMcpPython]: external script failed with exit code: 1 + {dataContext=MultiDataContextImpl(map={}, base=null)} ]}, status: failed]

I checked the version of the plugin on both machines and it matches. The connection is OK, because I have other jobs running on the Windows machine from Rundeck. I re-installed pywinrm module on both machines, because it looked like a problem with the actual module itself, but I doubt it.

What could be causing this? Below is the job definition:

- defaultTab: nodes
  description: |+
    Inserção de Horas via Excel

  executionEnabled: true
  group: DEV/Nav
  id: myuuid-myuuid-myuuid-myuuid-myuuid
  loglevel: INFO
  name: Report de Horas por Excel
  nodeFilterEditable: false
  nodefilters:
    dispatch:
      excludePrecedence: true
      keepgoing: false
      rankOrder: ascending
      successOnEmptyNodeFilter: false
      threadcount: '1'
    filter: mymachinename
  nodesSelectedByDefault: true
  options:
  - name: dest_path
    value : C:\INTEGRATIONS_APP\DEV\teste-ficheiro-rdm
  - name: my_file
    required: true
    type: file
  plugins:
    ExecutionLifecycle: {}
  scheduleEnabled: true
  sequence:
    commands:
    - configuration:
        destinationPath: ${option.dest_path}/${file.my_file.fileName}
        echo: 'true'
        recursive: 'false'
        sourcePath: ${file.my_file}
      nodeStep: true
      type: copyfile
    keepgoing: false
    strategy: node-first
  uuid: myuuid-myuuid-myuuid-myuuid

rac...@rundeck.com

unread,
Sep 25, 2024, 8:23:26 AM9/25/24
to rundeck-discuss
Hi,

Which Rundeck version are you using? Also, a couple of things to double-check:

1. Make sure to use Python 3 (can you check which Python version runs in the Rundeck instance for the pywinrm plugin?)
2. Please double-check the plugin requirements in the Rundeck instance.

Regards!

David Albuquerque

unread,
Sep 25, 2024, 12:57:20 PM9/25/24
to rundeck...@googlegroups.com
Hello.

Thanks for the tips, it helped me fix the problem!

If anyone else encounters this problem, what I did was go to Project
Settings > Edit Configuration > Default File Copier > And then change
the Python Interpreter from python to python3 (as suggested on point
1.).

Thanks again!

rac...@rundeck.com <rac...@rundeck.com> escreveu (quarta, 25/09/2024
à(s) 13:23):
> --
> You received this message because you are subscribed to a topic in the Google Groups "rundeck-discuss" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/rundeck-discuss/lMmaYJ3Idk4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to rundeck-discu...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/3e9ac188-98f4-448d-92df-b2c24d8e2c35n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages