Skip to content

Commit

Permalink
Merge pull request #33 from fabi200123/minor-fix
Browse files Browse the repository at this point in the history
fix: Adds validation for the new commands
  • Loading branch information
gabriel-samfira authored Sep 4, 2024
2 parents dfdf8e2 + 0eb0ffc commit 817280b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion execution/v0.1.0/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 6 additions & 1 deletion execution/v0.1.1/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 817280b

Please sign in to comment.