Skip to content

Commit 3907fee

Browse files
author
ssongliu
committed
fix: Fix the exception of some 1pctl commands
1 parent d09a3d8 commit 3907fee

24 files changed

Lines changed: 66 additions & 34 deletions

File tree

โ€Žagent/utils/cloud_storage/client/up.goโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func (o upClient) ListBuckets() ([]interface{}, error) {
3131

3232
func (s upClient) Upload(src, target string) (bool, error) {
3333
if _, err := s.client.GetInfo(path.Dir(src)); err != nil {
34-
_ = s.client.Mkdir(path.Dir(src))
34+
_ = s.client.Mkdir(path.Dir(target))
3535
}
3636
if err := s.client.Put(&upyun.PutObjectConfig{
3737
Path: target,

โ€Žcore/app/service/upgrade.goโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func (u *UpgradeService) Upgrade(req dto.Upgrade) error {
130130
_ = settingRepo.Update("SystemStatus", "Free")
131131
return
132132
}
133-
itemLog := model.UpgradeLog{NodeID: 0, OldVersion: global.CONF.Base.Version, NewVersion: req.Version, BackupFile: originalDir}
133+
itemLog := model.UpgradeLog{NodeID: 0, OldVersion: global.CONF.Base.Version, NewVersion: req.Version, BackupFile: baseDir}
134134
_ = upgradeLogRepo.Create(&itemLog)
135135

136136
global.LOG.Info("backup original data successful, now start to upgrade!")

โ€Žcore/cmd/server/cmd/listen-ip.goโ€Ž

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"fmt"
55

6+
"github.com/1Panel-dev/1Panel/core/constant"
67
"github.com/1Panel-dev/1Panel/core/i18n"
78
"github.com/spf13/cobra"
89
)
@@ -51,11 +52,11 @@ func updateBindInfo(protocol string) error {
5152
if err != nil {
5253
return err
5354
}
54-
ipv6 := "disable"
55+
ipv6 := constant.StatusDisable
5556
tcp := "tcp4"
5657
address := "0.0.0.0"
5758
if protocol == "ipv6" {
58-
ipv6 = "enable"
59+
ipv6 = constant.StatusEnable
5960
tcp = "tcp6"
6061
address = "::"
6162
}

โ€Žcore/cmd/server/cmd/reset.goโ€Ž

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"fmt"
55

6+
"github.com/1Panel-dev/1Panel/core/constant"
67
"github.com/1Panel-dev/1Panel/core/i18n"
78
"github.com/spf13/cobra"
89
)
@@ -43,7 +44,7 @@ var resetMFACmd = &cobra.Command{
4344
return err
4445
}
4546

46-
return setSettingByKey(db, "MFAStatus", "disable")
47+
return setSettingByKey(db, "MFAStatus", constant.StatusDisable)
4748
},
4849
}
4950
var resetSSLCmd = &cobra.Command{
@@ -59,7 +60,7 @@ var resetSSLCmd = &cobra.Command{
5960
return err
6061
}
6162

62-
return setSettingByKey(db, "SSL", "disable")
63+
return setSettingByKey(db, "SSL", constant.StatusDisable)
6364
},
6465
}
6566
var resetEntranceCmd = &cobra.Command{

โ€Žcore/cmd/server/cmd/restore.goโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ var restoreCmd = &cobra.Command{
7373
}
7474
fmt.Println(i18n.GetMsgByKeyForCmd("RestoreStep4"))
7575
if _, err := os.Stat(path.Join(tmpPath, "db")); err == nil {
76-
dbPath := path.Join(baseDir, "1panel/db")
76+
dbPath := path.Join(baseDir, "1panel")
7777
if err := files.CopyItem(true, true, path.Join(tmpPath, "db"), dbPath); err != nil {
7878
global.LOG.Errorf("rollback 1panel db failed, err: %v", err)
7979
}

โ€Žcore/cmd/server/cmd/update.goโ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"strings"
1010
"unicode"
1111

12+
"github.com/1Panel-dev/1Panel/core/constant"
1213
"github.com/1Panel-dev/1Panel/core/global"
1314
"github.com/1Panel-dev/1Panel/core/i18n"
1415
"github.com/1Panel-dev/1Panel/core/utils/cmd"
@@ -136,7 +137,7 @@ func password() {
136137
return
137138
}
138139
complexSetting := getSettingByKey(db, "ComplexityVerification")
139-
if complexSetting == "enable" {
140+
if complexSetting == constant.StatusEnable {
140141
if isValidPassword("newPassword") {
141142
fmt.Println("\n" + i18n.GetMsgByKeyForCmd("UpdatePasswordFormat"))
142143
return

โ€Žcore/cmd/server/cmd/user-info.goโ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"fmt"
55

6+
"github.com/1Panel-dev/1Panel/core/constant"
67
"github.com/1Panel-dev/1Panel/core/global"
78
"github.com/1Panel-dev/1Panel/core/i18n"
89
"github.com/1Panel-dev/1Panel/core/utils/encrypt"
@@ -41,7 +42,7 @@ var userinfoCmd = &cobra.Command{
4142
address := getSettingByKey(db, "SystemIP")
4243

4344
protocol := "http"
44-
if ssl == "enable" {
45+
if ssl == constant.StatusEnable {
4546
protocol = "https"
4647
}
4748
if address == "" {

โ€Žcore/i18n/lang/en.yamlโ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ ErrNodeBoundLimit: "The current free node has reached its limit, please check an
6262
ErrNoSuchNode: "Node information not found, please check and retry!"
6363
ErrNodeUnbind: "This node is not within the license binding range, please check and retry!"
6464
ErrNodeBind: "This node is already bound to a license, please check and retry!"
65+
ErrNodeLocalRollback: "The primary node does not support direct rollback. Please manually execute the '1pctl restore' command to rollback!"
6566

6667
# alert
6768
ErrAlertSync: "Alert information sync error, please check and retry!"

โ€Žcore/i18n/lang/ja.yamlโ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ ErrNodeBoundLimit: "็พๅœจใฎ็„กๆ–™ใƒŽใƒผใƒ‰ใฏไธŠ้™ใซ้”ใ—ใพใ—ใŸใ€‚็ขบ่ช
6363
ErrNoSuchNode: "ใใฎใƒŽใƒผใƒ‰ๆƒ…ๅ ฑใŒ่ฆ‹ใคใ‹ใ‚Šใพใ›ใ‚“ใงใ—ใŸใ€็ขบ่ชใ—ใฆๅ†่ฉฆ่กŒใ—ใฆใใ ใ•ใ„!"
6464
ErrNodeUnbind: "ใใฎใƒŽใƒผใƒ‰ใฏใƒฉใ‚คใ‚ปใƒณใ‚นใฎใƒใ‚คใƒณใƒ‰็ฏ„ๅ›ฒๅ†…ใงใฏใ‚ใ‚Šใพใ›ใ‚“ใ€็ขบ่ชใ—ใฆๅ†่ฉฆ่กŒใ—ใฆใใ ใ•ใ„!"
6565
ErrNodeBind: "ใใฎใƒŽใƒผใƒ‰ใฏใƒฉใ‚คใ‚ปใƒณใ‚นใซใƒใ‚คใƒณใƒ‰ใ•ใ‚Œใฆใ„ใพใ™ใ€็ขบ่ชใ—ใฆๅ†่ฉฆ่กŒใ—ใฆใใ ใ•ใ„!"
66+
ErrNodeLocalRollback: "ใƒžใ‚นใ‚ฟใƒผใƒŽใƒผใƒ‰ใฏ็›ดๆŽฅใƒญใƒผใƒซใƒใƒƒใ‚ฏใ‚’ใ‚ตใƒใƒผใƒˆใ—ใฆใ„ใพใ›ใ‚“ใ€‚ๆ‰‹ๅ‹•ใงใ€Œ1pctl restoreใ€ใ‚ณใƒžใƒณใƒ‰ใ‚’ๅฎŸ่กŒใ—ใฆใƒญใƒผใƒซใƒใƒƒใ‚ฏใ—ใฆใใ ใ•ใ„๏ผ"
6667

6768
# alert
6869
ErrAlertSync: "ใ‚ขใƒฉใƒผใƒˆๆƒ…ๅ ฑใฎๅŒๆœŸใ‚จใƒฉใƒผใงใ™ใ€‚ๅพŒใงๅ†่ฉฆ่กŒใ—ใฆใใ ใ•ใ„๏ผ"

โ€Žcore/i18n/lang/ko.yamlโ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ ErrNodeBoundLimit: "ํ˜„์žฌ ๋ฌด๋ฃŒ ๋…ธ๋“œ๊ฐ€ ํ•œ๋„์— ๋„๋‹ฌํ–ˆ์Šต๋‹ˆ๋‹ค. ํ™•์ธ
6262
ErrNoSuchNode: "๋…ธ๋“œ ์ •๋ณด๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ๋‹ค์‹œ ํ™•์ธํ•˜๊ณ  ์‹œ๋„ํ•ด ์ฃผ์„ธ์š”!"
6363
ErrNodeUnbind: "์ด ๋…ธ๋“œ๊ฐ€ ๋ผ์ด์„ ์Šค ๋ฐ”์ธ๋”ฉ ๋ฒ”์œ„์— ์žˆ์ง€ ์•Š์Œ์„ ๊ฐ์ง€ํ•˜์˜€์Šต๋‹ˆ๋‹ค. ๋‹ค์‹œ ํ™•์ธํ•˜๊ณ  ์‹œ๋„ํ•ด ์ฃผ์„ธ์š”!"
6464
ErrNodeBind: "์ด ๋…ธ๋“œ๊ฐ€ ์ด๋ฏธ ๋ผ์ด์„ ์Šค์— ๋ฐ”์ธ๋”ฉ๋˜์–ด ์žˆ์Œ์„ ๊ฐ์ง€ํ•˜์˜€์Šต๋‹ˆ๋‹ค. ๋‹ค์‹œ ํ™•์ธํ•˜๊ณ  ์‹œ๋„ํ•ด ์ฃผ์„ธ์š”!"
65+
ErrNodeLocalRollback: "๋งˆ์Šคํ„ฐ ๋…ธ๋“œ๋Š” ์ง์ ‘ ๋กค๋ฐฑ์„ ์ง€์›ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ˆ˜๋™์œผ๋กœ '1pctl restore' ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ๋กค๋ฐฑํ•˜์„ธ์š”!"
6566

6667
# alert
6768
ErrAlertSync: "๊ฒฝ๊ณ  ์ •๋ณด ๋™๊ธฐํ™” ์˜ค๋ฅ˜, ๋‹ค์‹œ ํ™•์ธํ•˜๊ณ  ์‹œ๋„ํ•ด ์ฃผ์„ธ์š”!"

0 commit comments

Comments
ย (0)