summaryrefslogtreecommitdiff
path: root/libpod/events/events.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-08-05 21:59:24 +0200
committerGitHub <noreply@github.com>2019-08-05 21:59:24 +0200
commitd46c7644cf631a67d86abb74b397096ec56bda6f (patch)
treed5ffcbc28ec1769cab3ecf53fe9abfdc55c65841 /libpod/events/events.go
parent3b1ee6990c0e90e0a7ee4233e3ce3bc6487c8a4f (diff)
parent29c137ff665314f18a65cf55ba55522e702987b3 (diff)
downloadpodman-d46c7644cf631a67d86abb74b397096ec56bda6f.tar.gz
podman-d46c7644cf631a67d86abb74b397096ec56bda6f.tar.bz2
podman-d46c7644cf631a67d86abb74b397096ec56bda6f.zip
Merge pull request #3724 from mheon/v1.4.2-stable1
V1.4.2 stable1
Diffstat (limited to 'libpod/events/events.go')
-rw-r--r--libpod/events/events.go25
1 files changed, 23 insertions, 2 deletions
diff --git a/libpod/events/events.go b/libpod/events/events.go
index 1ec79bcd7..5e828bc8a 100644
--- a/libpod/events/events.go
+++ b/libpod/events/events.go
@@ -16,11 +16,30 @@ var ErrNoJournaldLogging = errors.New("No support for journald logging")
// String returns a string representation of EventerType
func (et EventerType) String() string {
- if et == LogFile {
+ switch et {
+ case LogFile:
return "file"
+ case Journald:
+ return "journald"
+ case Null:
+ return "none"
+ default:
+ return "invalid"
+ }
+}
+// IsValidEventer checks if the given string is a valid eventer type.
+func IsValidEventer(eventer string) bool {
+ switch eventer {
+ case LogFile.String():
+ return true
+ case Journald.String():
+ return true
+ case Null.String():
+ return true
+ default:
+ return false
}
- return "journald"
}
// NewEvent creates a event struct and populates with
@@ -95,6 +114,8 @@ func StringToType(name string) (Type, error) {
return System, nil
case Volume.String():
return Volume, nil
+ case "":
+ return "", ErrEventTypeBlank
}
return "", errors.Errorf("unknown event type %q", name)
}