events: be nice to Sprintf
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
935645b03a
commit
ab4181649b
@ -77,25 +77,25 @@ func getEventOutput(evt *event.Envelope) (string, error) {
|
|||||||
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
out = fmt.Sprintf("id=%s", e.ContainerID)
|
out = "id=" + e.ContainerID
|
||||||
case "types.containerd.io/containerd.v1.types.event.TaskDelete":
|
case "types.containerd.io/containerd.v1.types.event.TaskDelete":
|
||||||
e := &event.TaskDelete{}
|
e := &event.TaskDelete{}
|
||||||
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
out = fmt.Sprintf("id=%s", e.ContainerID)
|
out = "id=" + e.ContainerID
|
||||||
case "types.containerd.io/containerd.v1.types.event.ContainerUpdate":
|
case "types.containerd.io/containerd.v1.types.event.ContainerUpdate":
|
||||||
e := &event.ContainerUpdate{}
|
e := &event.ContainerUpdate{}
|
||||||
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
out = fmt.Sprintf("id=%s", e.ContainerID)
|
out = "id=" + e.ContainerID
|
||||||
case "types.containerd.io/containerd.v1.types.event.ContainerDelete":
|
case "types.containerd.io/containerd.v1.types.event.ContainerDelete":
|
||||||
e := &event.ContainerDelete{}
|
e := &event.ContainerDelete{}
|
||||||
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
out = fmt.Sprintf("id=%s", e.ContainerID)
|
out = "id=" + e.ContainerID
|
||||||
case "types.containerd.io/containerd.v1.types.event.SnapshotPrepare":
|
case "types.containerd.io/containerd.v1.types.event.SnapshotPrepare":
|
||||||
e := &event.SnapshotPrepare{}
|
e := &event.SnapshotPrepare{}
|
||||||
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
||||||
@ -113,7 +113,7 @@ func getEventOutput(evt *event.Envelope) (string, error) {
|
|||||||
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
out = fmt.Sprintf("key=%s", e.Key)
|
out = "key=" + e.Key
|
||||||
case "types.containerd.io/containerd.v1.types.event.ImagePut":
|
case "types.containerd.io/containerd.v1.types.event.ImagePut":
|
||||||
e := &event.ImagePut{}
|
e := &event.ImagePut{}
|
||||||
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
||||||
@ -125,7 +125,7 @@ func getEventOutput(evt *event.Envelope) (string, error) {
|
|||||||
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
out = fmt.Sprintf("name=%s", e.Name)
|
out = "name=" + e.Name
|
||||||
case "types.containerd.io/containerd.v1.types.event.NamespaceCreate":
|
case "types.containerd.io/containerd.v1.types.event.NamespaceCreate":
|
||||||
e := &event.NamespaceCreate{}
|
e := &event.NamespaceCreate{}
|
||||||
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
||||||
@ -143,7 +143,7 @@ func getEventOutput(evt *event.Envelope) (string, error) {
|
|||||||
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
out = fmt.Sprintf("name=%s", e.Name)
|
out = "name=" + e.Name
|
||||||
case "types.containerd.io/containerd.v1.types.event.RuntimeCreate":
|
case "types.containerd.io/containerd.v1.types.event.RuntimeCreate":
|
||||||
e := &event.RuntimeCreate{}
|
e := &event.RuntimeCreate{}
|
||||||
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
|
||||||
|
@ -63,7 +63,3 @@ func (e *Emitter) Remove(clientID string) {
|
|||||||
}
|
}
|
||||||
e.m.Unlock()
|
e.m.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Emitter) Close() error {
|
|
||||||
return e.broadcaster.Close()
|
|
||||||
}
|
|
||||||
|
@ -54,6 +54,5 @@ func (s *eventSink) Write(evt goevents.Event) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *eventSink) Close() error {
|
func (s *eventSink) Close() error {
|
||||||
close(s.ch)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ func init() {
|
|||||||
Type: plugin.GRPCPlugin,
|
Type: plugin.GRPCPlugin,
|
||||||
ID: "events",
|
ID: "events",
|
||||||
Init: func(ic *plugin.InitContext) (interface{}, error) {
|
Init: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
logrus.Debug(ic.Emitter)
|
|
||||||
return NewService(ic.Emitter), nil
|
return NewService(ic.Emitter), nil
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user