mirror of
https://github.com/moby/moby.git
synced 2026-01-11 02:31:44 +00:00
daemon: inline copyAttributes utilty
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -24,7 +24,9 @@ func (daemon *Daemon) LogContainerEvent(container *container.Container, action e
|
||||
|
||||
// LogContainerEventWithAttributes generates an event related to a container with specific given attributes.
|
||||
func (daemon *Daemon) LogContainerEventWithAttributes(container *container.Container, action events.Action, attributes map[string]string) {
|
||||
copyAttributes(attributes, container.Config.Labels)
|
||||
if container.Config.Labels != nil {
|
||||
maps.Copy(attributes, container.Config.Labels)
|
||||
}
|
||||
if container.Config.Image != "" {
|
||||
attributes["image"] = container.Config.Image
|
||||
}
|
||||
@@ -90,14 +92,6 @@ func (daemon *Daemon) UnsubscribeFromEvents(listener chan any) {
|
||||
daemon.EventsService.Evict(listener)
|
||||
}
|
||||
|
||||
// copyAttributes guarantees that labels are not mutated by event triggers.
|
||||
func copyAttributes(attributes, labels map[string]string) {
|
||||
if labels == nil {
|
||||
return
|
||||
}
|
||||
maps.Copy(attributes, labels)
|
||||
}
|
||||
|
||||
// ProcessClusterNotifications gets changes from store and add them to event list
|
||||
func (daemon *Daemon) ProcessClusterNotifications(ctx context.Context, watchStream chan *swarmapi.WatchMessage) {
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user