Skip to content

Commit

Permalink
pkg: api: Prototype of registering container types
Browse files Browse the repository at this point in the history
  • Loading branch information
ish-hcc committed Dec 5, 2024
1 parent 84b34bd commit bbefe58
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/api/rest/controller/software.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,14 @@ func RegisterSoftware(c echo.Context) error {
return common.ReturnErrorMsg(c, "Please provide the version")
}

if softwareRegisterReq.OS == "" {
return common.ReturnErrorMsg(c, "Please provide the os")
}
if softwareRegisterReq.InstallType != "container" {
if softwareRegisterReq.OS == "" {
return common.ReturnErrorMsg(c, "Please provide the os")
}

if softwareRegisterReq.OSVersion == "" {
return common.ReturnErrorMsg(c, "Please provide the os version")
if softwareRegisterReq.OSVersion == "" {
return common.ReturnErrorMsg(c, "Please provide the os version")
}
}

if len(softwareRegisterReq.MatchNames) == 0 {
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/rest/model/software.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ func CheckInstallType(input string) error {
switch input {
case "package":
fallthrough
case "container":
fallthrough
case "script":
return nil
default:
Expand Down

0 comments on commit bbefe58

Please sign in to comment.