Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

发布配置: 支持py脚本 #694

Open
wants to merge 1 commit into
base: 3.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions spug_api/apps/deploy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions spug_web/src/pages/deploy/app/Ext2Setup2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down