Skip to content

Commit

Permalink
fix: filter the case when sn is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
wudihechao committed May 20, 2024
1 parent e3a9135 commit a9ae8c1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
4 changes: 0 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,6 @@ func (c *ConfigType) GetHostIP() string {
}
func (c *ConfigType) GetHostSN() string {
ret := HostInfo.GetSN()
if ret == "" {
return c.GetHostname()
}

return ret
}
func GetEnv(key string) string {
Expand Down
6 changes: 2 additions & 4 deletions config/hostname.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ func InitHostInfo() error {
ip = fmt.Sprint(nip)
}
var sn string
sn, err = GetBiosSn()
if err != nil {
return err
}
// allow sn empty
sn, _ = GetBiosSn()
HostInfo = &HostInfoCache{
name: hostname,
ip: fmt.Sprint(ip),
Expand Down

0 comments on commit a9ae8c1

Please sign in to comment.