mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-22 15:28:35 +08:00
fix: Fix the issue of abnormal ufw status loading (#10949)
This commit is contained in:
parent
402931862f
commit
e4fbd3cf86
2 changed files with 3 additions and 9 deletions
|
|
@ -59,21 +59,15 @@ func (u *FirewallService) LoadBaseInfo(tab string) (dto.FirewallBaseInfo, error)
|
||||||
baseInfo.Name = client.Name()
|
baseInfo.Name = client.Name()
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(4)
|
wg.Add(2)
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
baseInfo.PingStatus = u.pingStatus()
|
baseInfo.PingStatus = u.pingStatus()
|
||||||
}()
|
|
||||||
go func() {
|
|
||||||
defer wg.Done()
|
|
||||||
baseInfo.IsActive, _ = client.Status()
|
|
||||||
}()
|
|
||||||
go func() {
|
|
||||||
defer wg.Done()
|
|
||||||
baseInfo.Version, _ = client.Version()
|
baseInfo.Version, _ = client.Version()
|
||||||
}()
|
}()
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
baseInfo.IsActive, _ = client.Status()
|
||||||
baseInfo.IsInit, baseInfo.IsBind = loadInitStatus(baseInfo.Name, tab)
|
baseInfo.IsInit, baseInfo.IsBind = loadInitStatus(baseInfo.Name, tab)
|
||||||
}()
|
}()
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ func CheckChainExist(tab, chain string) (bool, error) {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
func CheckChainBind(tab, parentChain, chain string) (bool, error) {
|
func CheckChainBind(tab, parentChain, chain string) (bool, error) {
|
||||||
stdout, err := RunWithStd(tab, fmt.Sprintf("-L %s | grep -w %s", parentChain, chain))
|
stdout, err := RunWithStd(tab, fmt.Sprintf("-S %s | grep -- '-j %s'", parentChain, chain))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
global.LOG.Errorf("check chain %s from tab %s is bind to %s failed, err: %v", chain, tab, parentChain, err)
|
global.LOG.Errorf("check chain %s from tab %s is bind to %s failed, err: %v", chain, tab, parentChain, err)
|
||||||
return false, fmt.Errorf("check chain %s from tab %s is bind to %s failed, err: %v", chain, tab, parentChain, err)
|
return false, fmt.Errorf("check chain %s from tab %s is bind to %s failed, err: %v", chain, tab, parentChain, err)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue