From 4c37b7541905dc7ba21b3462533cc72f0ca893a4 Mon Sep 17 00:00:00 2001 From: Puran Adhikari <7930721+PuranAdhikari@users.noreply.github.com> Date: Fri, 31 Mar 2023 20:44:08 +0545 Subject: [PATCH] fix(): file parse issue resolution Signed-off-by: Puran Adhikari --- pkg/events/events_parser.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/pkg/events/events_parser.go b/pkg/events/events_parser.go index 8b34990..1d8ee09 100644 --- a/pkg/events/events_parser.go +++ b/pkg/events/events_parser.go @@ -37,17 +37,15 @@ func GetEvent(name EventName) (*EventSchema, error) { } func IsEventDisabled(name EventName) bool { - controllerFilePath := "/events/event-schema/controller.yaml" - workerFilePath := "/events/event-schema/worker.yaml" - controllerConfigs, err := parseConfig(controllerFilePath) - if err != nil { - return false - } - workerConfigs, err := parseConfig(workerFilePath) + return isDisabledInFile(name, "/events/event-schema/controller.yaml") || + isDisabledInFile(name, "/events/event-schema/worker.yaml") +} + +func isDisabledInFile(name EventName, filepath string) bool { + configs, err := parseConfig(filepath) if err != nil { return false } - configs := append(controllerConfigs, workerConfigs...) for _, config := range configs { if config == string(name) { return true