-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move ValidateResult to common package
- Loading branch information
1 parent
0824416
commit 7074f01
Showing
3 changed files
with
39 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package common | ||
|
||
import ( | ||
garmErrors "github.com/cloudbase/garm-provider-common/errors" | ||
commonParams "github.com/cloudbase/garm-provider-common/params" | ||
"github.com/cloudbase/garm/runner/providers/util" | ||
) | ||
|
||
func ValidateResult(inst commonParams.ProviderInstance) error { | ||
if inst.ProviderID == "" { | ||
return garmErrors.NewProviderError("missing provider ID") | ||
} | ||
|
||
if inst.Name == "" { | ||
return garmErrors.NewProviderError("missing instance name") | ||
} | ||
|
||
if !util.IsValidProviderStatus(inst.Status) { | ||
return garmErrors.NewProviderError("invalid status returned (%s)", inst.Status) | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters