From 0eb0ffc5da1ea3ed6682ff5ee7ea7e9d6314c7b9 Mon Sep 17 00:00:00 2001 From: Fabian Fulga Date: Wed, 4 Sep 2024 10:08:59 +0300 Subject: [PATCH] Small fix regarding new commands validation --- execution/v0.1.0/execution.go | 2 +- execution/v0.1.1/execution.go | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/execution/v0.1.0/execution.go b/execution/v0.1.0/execution.go index 6b42668..60735f7 100644 --- a/execution/v0.1.0/execution.go +++ b/execution/v0.1.0/execution.go @@ -106,7 +106,7 @@ func (e EnvironmentV010) Validate() error { return fmt.Errorf("missing controller ID") } case common.GetVersionCommand: - if semver.IsValid(e.InterfaceVersion) { + if !semver.IsValid(e.InterfaceVersion) { return fmt.Errorf("invalid interface version: %s", e.InterfaceVersion) } default: diff --git a/execution/v0.1.1/execution.go b/execution/v0.1.1/execution.go index 9dcc4ad..ab643b0 100644 --- a/execution/v0.1.1/execution.go +++ b/execution/v0.1.1/execution.go @@ -112,7 +112,12 @@ func (e EnvironmentV011) Validate() error { return fmt.Errorf("missing controller ID") } case common.GetVersionCommand: - if semver.IsValid(e.InterfaceVersion) { + if !semver.IsValid(e.InterfaceVersion) { + return fmt.Errorf("invalid interface version: %s", e.InterfaceVersion) + } + case common.ValidatePoolInfoCommand, common.GetConfigJSONSchemaCommand, + common.GetExtraSpecsJSONSchemaCommand: + if !semver.IsValid(e.InterfaceVersion) && e.InterfaceVersion == common.Version010 { return fmt.Errorf("invalid interface version: %s", e.InterfaceVersion) } default: