Skip to content

Commit

Permalink
Merge pull request #14 from SoftIron/fix_vm
Browse files Browse the repository at this point in the history
fix: add more VM context keys
  • Loading branch information
masonkatz committed Jun 4, 2024
2 parents e6f9421 + ab604c0 commit 074e87a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cloud/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,11 @@ type Context struct {
Firmware string
GuestOS string
Network bool
SSHPublicKey string
Target string
Token bool
ProjectName string
SetHostname string
SSHPublicKey string
}

// OS is the API payload based on the legacy xmlrpc backend.
Expand Down
8 changes: 8 additions & 0 deletions cloud/instance/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,14 @@ func setContextValue(dst *Context, key string, value any) error {
dst.Target = v
case "PROJECT_NAME":
dst.ProjectName = v
case "SET_HOSTNAME":
dst.SetHostname = v
case "TOKEN":
b, err := api.Str2Bool(v)
if err != nil {
return fmt.Errorf("invalid TOKEN value %q: %w", v, err)
}
dst.Token = b
default:
return fmt.Errorf("unknown key: %s", key)
}
Expand Down
4 changes: 2 additions & 2 deletions cloud/responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -906,9 +906,9 @@ type DeleteTemplateResponse struct {
Template int `json:"template"`
}

// InstantiateTemplateResponse is the response body for DELETE /cloud/template/{template}.
// InstantiateTemplateResponse is the response body for POST /cloud/template/{template}.
type InstantiateTemplateResponse struct {
Template int `json:"template"`
Instance int `json:"instance"`
}

// UpdateTemplateResponse is the response body for PATCH /cloud/template.
Expand Down

0 comments on commit 074e87a

Please sign in to comment.