Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix object provided as argument of DeleteLogObject #2714

Merged
merged 1 commit into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pkg/pillar/base/logobjecttypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,15 +359,17 @@ func EnsureLogObject(logBase *LogObject, objType LogObjectType, objName string,
return logObject
}

// DeleteLogObject :
// DeleteLogObject : Delete log object from internal map
// logBase must be the same object as for calls to EnsureLogObject and NewLogObject
func DeleteLogObject(logBase *LogObject, key string) {
if logBase == nil {
logrus.Fatalf("No logBase for %s", key)
}
mapKey := logBase.mapKey(key)
_, ok := logObjectMap.Load(mapKey)
if !ok {
logrus.Errorf("DeleteLogObject: LogObject with mapKey %s not found in internal map", mapKey)
// use logBase as logger to show agent in source instead of zedbox
logBase.Errorf("DeleteLogObject: LogObject with mapKey %s not found in internal map", mapKey)
return
}
logObjectMap.Delete(mapKey)
Expand Down
2 changes: 1 addition & 1 deletion pkg/pillar/types/contenttreetypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (config ContentTreeConfig) LogDelete(logBase *base.LogObject) {
AddField("max-download-size-int64", config.MaxDownloadSize).
Noticef("Content tree config delete")

base.DeleteLogObject(logObject, config.LogKey())
base.DeleteLogObject(logBase, config.LogKey())
}

// LogKey :
Expand Down
2 changes: 1 addition & 1 deletion pkg/pillar/types/verifiertypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func (status VerifyImageStatus) LogDelete(logBase *base.LogObject) {
AddField("filelocation", status.FileLocation).
Noticef("VerifyImage status delete")

base.DeleteLogObject(logObject, status.LogKey())
base.DeleteLogObject(logBase, status.LogKey())
}

// LogKey :
Expand Down