Skip to content

Commit ee9c370

Browse files
committed
Fixed #27260 Handle new type and status in libpod/events/events.go
Signed-off-by: ByoungUk Lee <[email protected]>
1 parent 963e40a commit ee9c370

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

libpod/events/events.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ func (e *Event) ToHumanReadable(truncate bool) string {
9494
humanFormat = fmt.Sprintf("%s %s %s %s", e.Time, e.Type, e.Status, e.Name)
9595
case Secret:
9696
humanFormat = fmt.Sprintf("%s %s %s %s", e.Time, e.Type, e.Status, id)
97+
case Artifact:
98+
humanFormat = fmt.Sprintf("%s %s %s %s (name=%s", e.Time, e.Type, e.Status, id, e.Name)
99+
if len(e.Attributes) > 0 {
100+
for k, v := range e.Attributes {
101+
humanFormat += fmt.Sprintf(", %s=%s", k, v)
102+
}
103+
}
104+
humanFormat += ")"
97105
}
98106
return humanFormat
99107
}
@@ -127,6 +135,8 @@ func StringToType(name string) (Type, error) {
127135
return Volume, nil
128136
case Secret.String():
129137
return Secret, nil
138+
case Artifact.String():
139+
return Artifact, nil
130140
case "":
131141
return "", ErrEventTypeBlank
132142
}
@@ -136,6 +146,8 @@ func StringToType(name string) (Type, error) {
136146
// StringToStatus converts a string to an Event Status
137147
func StringToStatus(name string) (Status, error) {
138148
switch name {
149+
case Add.String():
150+
return Add, nil
139151
case Attach.String():
140152
return Attach, nil
141153
case AutoUpdate.String():
@@ -156,6 +168,8 @@ func StringToStatus(name string) (Status, error) {
156168
return ExecDied, nil
157169
case Exited.String():
158170
return Exited, nil
171+
case Extract.String():
172+
return Extract, nil
159173
case Export.String():
160174
return Export, nil
161175
case HealthStatus.String():

0 commit comments

Comments
 (0)