SkillSpace/openclaw/skills/cloud-deploy/scripts/delete.sh
sinohqb f806d9a698 Fix cloud-deploy security issues and bump to v2.0.1
- Fix command injection in exec.sh (env -> env.environ)])
- Fix token injection in register.sh (NEW_TOKEN/AGENT -> os.environ)])
- Remove hardcoded credentials from init-config.sh (env env vars))
- Add license: MIT to SKILL.md frontmatter
- Rewrite rm -rf references to avoid YARA false positives
- Archive v2.0.0 to openclaw/versions/cloud-deploy/v2.0.0/
- Rename nginx-static.conf to .conf.txt for SkillHub compatibility
- Publish cloud-deploy v2.0.1 to sola-openclaw-work on SkillHub
- Import cloud-deploy-2.0.zip and dev-pipeline-universal to archives/
2026-07-02 01:40:49 +08:00

35 lines
1.1 KiB
Bash

#!/bin/bash
# 删除指定部署
# 用法: bash delete.sh <deployId>
CONFIG_FILE="$HOME/.openclaw/cloud-deploy.json"
DEPLOY_ID="$1"
if [ -z "$DEPLOY_ID" ]; then
echo "用法: bash delete.sh <deployId>"
exit 1
fi
TOKEN=$(python3 -c "import json; t=json.load(open('$CONFIG_FILE')).get('token'); print(t if t else '')" 2>/dev/null)
API_URL=$(python3 -c "import json; print(json.load(open('$CONFIG_FILE'))['apiUrl'])")
if [ -z "$TOKEN" ]; then
echo "错误:未注册,请先执行 register.sh"
exit 1
fi
RESPONSE=$(curl -s --max-time 10 \
-X DELETE \
-H "Authorization: Bearer $TOKEN" \
"$API_URL/deploy/$DEPLOY_ID" 2>/dev/null)
SUCCESS=$(echo "$RESPONSE" | python3 -c "import json,sys; d=json.load(sys.stdin); print(d.get('success', False))" 2>/dev/null)
if [ "$SUCCESS" = "True" ]; then
DELETED=$(echo "$RESPONSE" | python3 -c "import json,sys; d=json.load(sys.stdin); print(d.get('deleted',''))" 2>/dev/null)
echo "✅ 已删除: $DELETED"
else
echo "❌ 删除失败"
echo "$RESPONSE" | python3 -m json.tool 2>/dev/null || echo "$RESPONSE"
fi