cockpit: new project uses ~/pipeline_ws as workspace base

This commit is contained in:
ymq 2026-08-08 11:27:03 +08:00
parent d0a801f283
commit abf5e82945

View File

@ -658,18 +658,18 @@ if action == 'send_message':
await _save_context(sor, uid, proj.id, '')
else:
pid = getID()
# 创建工作目录:检测 /d 可写性,不可写时回退 /tmp/pipeline_ws
ws_base = '/d/pipeline/workspaces'
# 创建工作目录:优先 ~/pipeline_ws不可写时回退
ws_base = os.path.expanduser('~/pipeline_ws')
try:
if not os.path.isdir(os.path.dirname(ws_base)) or not os.access(os.path.dirname(ws_base), os.W_OK):
ws_base = '/tmp/pipeline_ws'
os.makedirs(ws_base, exist_ok=True)
except Exception:
ws_base = '/tmp/pipeline_ws'
os.makedirs(ws_base, exist_ok=True)
ws_dir = f"{ws_base}/{org_id}/{pname}"
try:
os.makedirs(ws_dir, exist_ok=True)
except Exception:
ws_dir = f"/tmp/pipeline_ws/{pname}"
ws_dir = os.path.expanduser(f'~/pipeline_ws/{pname}')
os.makedirs(ws_dir, exist_ok=True)
await sor.C('sd_projects', {
'id': pid, 'name': pname, 'description': intent.get('description', ''),