fix: Fix the issue where some applications fail to execute scripts (#9508)

This commit is contained in:
CityFun 2025-07-14 12:21:51 +08:00 committed by GitHub
parent e5263d6c05
commit 765add6184
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 11 deletions

View file

@ -170,7 +170,7 @@ func createLink(ctx context.Context, installTask *task.Task, app model.App, appI
} }
switch app.Key { 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, ok := params["PANEL_DB_ROOT_PASSWORD"]; ok {
if password != "" { if password != "" {
database.Password = password.(string) 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 { if password, ok := params["PANEL_REDIS_ROOT_PASSWORD"]; ok {
authParam := dto.RedisAuthParam{ authParam := dto.RedisAuthParam{
RootPassword: "", RootPassword: "",
@ -968,9 +968,11 @@ func runScript(task *task.Task, appInstall *model.AppInstall, operate string) er
case "uninstall": case "uninstall":
scriptPath = path.Join(workDir, "scripts", "uninstall.sh") scriptPath = path.Join(workDir, "scripts", "uninstall.sh")
} }
if !files.NewFileOp().Stat(scriptPath) { fileOp := files.NewFileOp()
if !fileOp.Stat(scriptPath) {
return nil return nil
} }
_ = fileOp.ChmodR(scriptPath, constant.DirPerm, false)
logStr := i18n.GetWithName("ExecShell", operate) logStr := i18n.GetWithName("ExecShell", operate)
task.LogStart(logStr) task.LogStart(logStr)

View file

@ -6,14 +6,17 @@ const (
AppNormal = "Normal" AppNormal = "Normal"
AppTakeDown = "TakeDown" AppTakeDown = "TakeDown"
AppOpenresty = "openresty" AppOpenresty = "openresty"
AppMysql = "mysql" AppMysql = "mysql"
AppMariaDB = "mariadb" AppMariaDB = "mariadb"
AppPostgresql = "postgresql" AppPostgresql = "postgresql"
AppRedis = "redis" AppRedis = "redis"
AppPostgres = "postgres" AppPostgres = "postgres"
AppMongodb = "mongodb" AppMongodb = "mongodb"
AppMemcached = "memcached" AppMemcached = "memcached"
AppMysqlCluster = "mysql-cluster"
AppPostgresqlCluster = "postgresql-cluster"
AppRedisCluster = "redis-cluster"
AppResourceLocal = "local" AppResourceLocal = "local"
AppResourceRemote = "remote" AppResourceRemote = "remote"