发布配置: 支持py脚本

发布配置: 支持py脚本
pull/694/head
pangp 2024-10-25 11:42:26 +08:00 committed by pangpeng
parent e9c161bcbe
commit 35b479c508
2 changed files with 8 additions and 0 deletions

View File

@ -317,6 +317,8 @@ def _deploy_ext2_host(helper, h_id, actions, env, spug_version):
command = f'mkdir -p /tmp/{spug_version} && tar xf /tmp/{tar_gz_file} -C /tmp/{spug_version}/ '
command += f'&& rm -rf {action["dst"]} && mv /tmp/{spug_version}/{sd_dst} {action["dst"]} '
command += f'&& rm -rf /tmp/{spug_version}* && echo "transfer completed"'
elif action.get('interpreter', 'shell') == 'python':
command = f"cd /tmp && python3 <<EOF\n{action['data']}\nEOF"
else:
command = f'cd /tmp && {action["data"]}'
helper.remote(host.id, ssh, command)

View File

@ -129,6 +129,12 @@ class Ext2Setup2 extends React.Component {
<Input disabled={store.isReadOnly} value={item['title']} onChange={e => item['title'] = e.target.value}
placeholder="请输入"/>
</Form.Item>
<Form.Item required label='解释器'>
<Select value={item['interpreter']} placeholder={'请选择'} onChange={value => item['interpreter'] = value}>
<Select.Option key={'shell'} value={'shell'}>shell</Select.Option>
<Select.Option key={'python'} value={'python'}>python</Select.Option>
</Select>
</Form.Item>
{item['type'] === 'transfer' ? ([
<Form.Item key={0} required label="数据来源">
<Input