From 765add61847f37dd3eee728471ed102d36dc440b Mon Sep 17 00:00:00 2001 From: CityFun <31820853+zhengkunwang223@users.noreply.github.com> Date: Mon, 14 Jul 2025 12:21:51 +0800 Subject: [PATCH] fix: Fix the issue where some applications fail to execute scripts (#9508) --- agent/app/service/app_utils.go | 8 +++++--- agent/constant/app.go | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/agent/app/service/app_utils.go b/agent/app/service/app_utils.go index 097e42da9..57faafce6 100644 --- a/agent/app/service/app_utils.go +++ b/agent/app/service/app_utils.go @@ -170,7 +170,7 @@ func createLink(ctx context.Context, installTask *task.Task, app model.App, appI } switch app.Key { - case constant.AppMysql, constant.AppMariaDB, constant.AppPostgresql, constant.AppMongodb: + case constant.AppMysql, constant.AppMariaDB, constant.AppPostgresql, constant.AppMongodb, constant.AppMysqlCluster, constant.AppPostgresqlCluster: if password, ok := params["PANEL_DB_ROOT_PASSWORD"]; ok { if password != "" { database.Password = password.(string) @@ -192,7 +192,7 @@ func createLink(ctx context.Context, installTask *task.Task, app model.App, appI } } - case constant.AppRedis: + case constant.AppRedis, constant.AppRedisCluster: if password, ok := params["PANEL_REDIS_ROOT_PASSWORD"]; ok { authParam := dto.RedisAuthParam{ RootPassword: "", @@ -968,9 +968,11 @@ func runScript(task *task.Task, appInstall *model.AppInstall, operate string) er case "uninstall": scriptPath = path.Join(workDir, "scripts", "uninstall.sh") } - if !files.NewFileOp().Stat(scriptPath) { + fileOp := files.NewFileOp() + if !fileOp.Stat(scriptPath) { return nil } + _ = fileOp.ChmodR(scriptPath, constant.DirPerm, false) logStr := i18n.GetWithName("ExecShell", operate) task.LogStart(logStr) diff --git a/agent/constant/app.go b/agent/constant/app.go index 7dd5d3419..ee1efa62f 100644 --- a/agent/constant/app.go +++ b/agent/constant/app.go @@ -6,14 +6,17 @@ const ( AppNormal = "Normal" AppTakeDown = "TakeDown" - AppOpenresty = "openresty" - AppMysql = "mysql" - AppMariaDB = "mariadb" - AppPostgresql = "postgresql" - AppRedis = "redis" - AppPostgres = "postgres" - AppMongodb = "mongodb" - AppMemcached = "memcached" + AppOpenresty = "openresty" + AppMysql = "mysql" + AppMariaDB = "mariadb" + AppPostgresql = "postgresql" + AppRedis = "redis" + AppPostgres = "postgres" + AppMongodb = "mongodb" + AppMemcached = "memcached" + AppMysqlCluster = "mysql-cluster" + AppPostgresqlCluster = "postgresql-cluster" + AppRedisCluster = "redis-cluster" AppResourceLocal = "local" AppResourceRemote = "remote"