Python 如何在Rundeck选项中将optiontype用作文件

Python 如何在Rundeck选项中将optiontype用作文件,python,api,input,rundeck,Python,Api,Input,Rundeck,对于API请求,我的Python代码运行良好,其中选项类型为文本,对于某些输入值集,由逗号(,)分隔 我想使用选项类型为FILE的相同方法,其中每个输入值都包含新行 在使用中,我可以看到下面的选项,请让我知道当我试图在运行时上载文件时,在我的代码中使用下面的哪个选项 Commandline Arguments: ${file.Serial_Number} Script Content: @file.Serial_Number@ The original file name: Bash: $RD_

对于API请求,我的Python代码运行良好,其中选项类型为文本,对于某些输入值集,由逗号(,)分隔

我想使用选项类型为FILE的相同方法,其中每个输入值都包含新行

在使用中,我可以看到下面的选项,请让我知道当我试图在运行时上载文件时,在我的代码中使用下面的哪个选项

Commandline Arguments: ${file.Serial_Number}
Script Content: @file.Serial_Number@
The original file name:
Bash: $RD_FILE_SERIAL_NUMBER_FILENAME
Commandline Arguments: ${file.Serial_Number.fileName}
Script Content: @file.Serial_Number.fileName@
The file content SHA-256 value:
Bash: $RD_FILE_SERIAL_NUMBER_SHA
Commandline Arguments: ${file.Serial_Number.sha}
Script Content: @file.Serial_Number.sha@```


我留下一个作业定义示例,您可以检查如何获取内容、文件名和路径:

Python脚本:

导入操作系统
#内容
操作系统('cat@file.myfile@'))
打印(“\n”)
打印(“文件名:”)
打印(@file.myfile.fileName@\n)
打印(“文件路径:”)
打印(“@file.myfile@”)
工作定义:


节点
真的
b1d6e1e1-15e9-40c6-b6a9-317f31910fd0
信息
蟒蛇
假的
真的
白痴
/usr/bin/python3
b1d6e1e1-15e9-40c6-b6a9-317f31910fd0
示例文件“lipsum”:

结果呢

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.