简体   繁体   English

Rundeck 作业将文件传输到远程节点

[英]Rundeck job to transfer a file to a remote node

I am trying to transfer a file through sftp in rundeck to a remote node.It fails the job execution with the error Failed: WrongParameter: sourcePath has to be a directory.我正在尝试通过 rundeck 中的 sftp 将文件传输到远程节点。它使作业执行失败,并出现错误 Failed: WrongParameter: sourcePath has to be a directory。 my jod definition looks like this我的 jod 定义看起来像这样

<joblist>
  <job>
    <defaultTab>nodes</defaultTab>
    <description></description>
    <dispatch>
      <excludePrecedence>true</excludePrecedence>
      <keepgoing>false</keepgoing>
      <rankOrder>ascending</rankOrder>
      <successOnEmptyNodeFilter>false</successOnEmptyNodeFilter>
      <threadcount>1</threadcount>
    </dispatch>
    <executionEnabled>true</executionEnabled>
    <id>8b7a993e-441d-4073-9e88-5ec801950a43</id>
    <loglevel>INFO</loglevel>
    <name>mytestjob2</name>
    <nodeFilterEditable>false</nodeFilterEditable>
    <nodefilters>
      <filter>172.105.34.168</filter>
    </nodefilters>
    <nodesSelectedByDefault>true</nodesSelectedByDefault>
    <scheduleEnabled>true</scheduleEnabled>
    <sequence keepgoing='true' strategy='node-first'>
      <command>
        <description>ftp file</description>
        <node-step-plugin type='copyfile'>
          <configuration>
            <entry key='destinationPath' value='/root/destination/' />
            <entry key='echo' value='true' />
            <entry key='recursive' value='true' />
            <entry key='sourcePath' value='/root/source/' />
          </configuration>
        </node-step-plugin>
      </command>
    </sequence>
    <uuid>8b7a993e-441d-4073-9e88-5ec801950a43</uuid>
  </job>
</joblist>

Can you tell me where am I going wrong ? how should I suppy the source directory to rundeck.

You must set the temp path in "Source Path" textbox with ${file.Upload} and set the file name on "Destination Path" textbox using "${file.Upload.fileName}" (like cp / mv UNIX command).您必须使用${file.Upload}在“源路径”文本框中设置临时路径,并使用"${file.Upload.fileName}"在“目标路径”文本框中设置文件名(如cp / mv UNIX 命令)。

I leave a job definition that works (tested on Rundeck 3.3.1):我留下了一个有效的工作定义(在 Rundeck 3.3.1 上测试):

<joblist>
  <job>
    <context>
      <options preserveOrder='true'>
        <option name='Upload' type='file' />
      </options>
    </context>
    <defaultTab>output</defaultTab>
    <description></description>
    <dispatch>
      <excludePrecedence>true</excludePrecedence>
      <keepgoing>false</keepgoing>
      <rankOrder>ascending</rankOrder>
      <successOnEmptyNodeFilter>false</successOnEmptyNodeFilter>
      <threadcount>1</threadcount>
    </dispatch>
    <executionEnabled>true</executionEnabled>
    <id>6df7eb26-7f0f-46ed-bb60-cec9eb21b28b</id>
    <loglevel>INFO</loglevel>
    <name>UploadJob</name>
    <nodeFilterEditable>false</nodeFilterEditable>
    <nodefilters>
      <filter>name: remote</filter>
    </nodefilters>
    <nodesSelectedByDefault>true</nodesSelectedByDefault>
    <scheduleEnabled>true</scheduleEnabled>
    <sequence keepgoing='false' strategy='node-first'>
      <command>
        <node-step-plugin type='copyfile'>
          <configuration>
            <entry key='destinationPath' value='/home/user/${file.Upload.fileName}' />
            <entry key='echo' value='true' />
            <entry key='recursive' value='false' />
            <entry key='sourcePath' value='${file.Upload}' />
          </configuration>
        </node-step-plugin>
      </command>
    </sequence>
    <uuid>6df7eb26-7f0f-46ed-bb60-cec9eb21b28b</uuid>
  </job>
</joblist>

Here the result.结果在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM