Skip to content

Commit d650026

Browse files
CLI: Update hypeman SDK to 013dac97 and add --graceful-shutdown to rm
Bumps github.com/kernel/hypeman-go to 013dac97bc8391d82f4b583f1a579c3024f23f88, which adds InstanceDeleteParams so callers can skip the graceful guest shutdown that DELETE /instances/{id} performs by default. Exposes the new field as `hypeman rm --graceful-shutdown`. The value is only sent when explicitly set so the server default (true) still applies otherwise. Compose teardown passes empty params to preserve its current behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent d9957ff commit d650026

4 files changed

Lines changed: 16 additions & 5 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/google/go-containerregistry v0.20.7
1212
github.com/gorilla/websocket v1.5.3
1313
github.com/itchyny/json2yaml v0.1.4
14-
github.com/kernel/hypeman-go v0.26.1
14+
github.com/kernel/hypeman-go v0.26.2-0.20260831200520-013dac97bc83
1515
github.com/knadh/koanf/parsers/yaml v1.1.0
1616
github.com/knadh/koanf/providers/env v1.1.0
1717
github.com/knadh/koanf/providers/file v1.2.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnV
7878
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs=
7979
github.com/itchyny/json2yaml v0.1.4 h1:/pErVOXGG5iTyXHi/QKR4y3uzhLjGTEmmJIy97YT+k8=
8080
github.com/itchyny/json2yaml v0.1.4/go.mod h1:6iudhBZdarpjLFRNj+clWLAkGft+9uCcjAZYXUH9eGI=
81-
github.com/kernel/hypeman-go v0.26.1 h1:9SmUwDYL6A+1OzhzkS7auy+/XSef5uiaL9EHftrav/M=
82-
github.com/kernel/hypeman-go v0.26.1/go.mod h1:of8qI/nef2OPLzt0EMlIRbMdJHEvuc4yWG8g/ioNg48=
81+
github.com/kernel/hypeman-go v0.26.2-0.20260831200520-013dac97bc83 h1:KFdyS8ZsxRwf5M8qNfyrKWKXsT52NNV6907BtsIVhlk=
82+
github.com/kernel/hypeman-go v0.26.2-0.20260831200520-013dac97bc83/go.mod h1:of8qI/nef2OPLzt0EMlIRbMdJHEvuc4yWG8g/ioNg48=
8383
github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3JH2co=
8484
github.com/klauspost/compress v1.18.1/go.mod h1:ZQFFVG+MdnR0P+l6wpXgIL4NTtwiKIdBnrBd8Nrxr+0=
8585
github.com/knadh/koanf/maps v0.1.2 h1:RBfmAW5CnZT+PJ1CVc1QSJKf4Xu9kxfQgYVQSu8hpbo=

lib/compose/reconcile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ func (r *Runner) applyDelete(ctx context.Context, action *Action) error {
320320
return err
321321
}
322322
case "instance":
323-
if err := r.client.Instances.Delete(ctx, action.instanceID, r.opts...); err != nil && !isHTTPNotFound(err) {
323+
if err := r.client.Instances.Delete(ctx, action.instanceID, hypeman.InstanceDeleteParams{}, r.opts...); err != nil && !isHTTPNotFound(err) {
324324
return err
325325
}
326326
case "volume":
@@ -382,7 +382,7 @@ func (r *Runner) applyReplace(ctx context.Context, action *Action, opts UpOption
382382
switch action.Type {
383383
case "instance":
384384
if action.instanceID != "" {
385-
if err := r.client.Instances.Delete(ctx, action.instanceID, r.opts...); err != nil && !isHTTPNotFound(err) {
385+
if err := r.client.Instances.Delete(ctx, action.instanceID, hypeman.InstanceDeleteParams{}, r.opts...); err != nil && !isHTTPNotFound(err) {
386386
return err
387387
}
388388
}

pkg/cmd/rm.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ var rmCmd = cli.Command{
2323
Name: "all",
2424
Usage: "Remove all instances (stopped only, unless --force)",
2525
},
26+
&cli.BoolFlag{
27+
Name: "graceful-shutdown",
28+
Usage: "Attempt graceful guest shutdown before deleting the instance",
29+
Value: true,
30+
},
2631
},
2732
Action: handleRm,
2833
HideHelpCommand: true,
@@ -37,6 +42,11 @@ func handleRm(ctx context.Context, cmd *cli.Command) error {
3742
return fmt.Errorf("instance ID required\nUsage: hypeman rm [flags] <instance> [instance...]\n hypeman rm --all [--force]")
3843
}
3944

45+
deleteParams := hypeman.InstanceDeleteParams{}
46+
if cmd.IsSet("graceful-shutdown") {
47+
deleteParams.GracefulShutdown = hypeman.Opt(cmd.Bool("graceful-shutdown"))
48+
}
49+
4050
client := hypeman.NewClient(getDefaultRequestOptions(cmd)...)
4151

4252
// If --all, get all instance IDs
@@ -107,6 +117,7 @@ func handleRm(ctx context.Context, cmd *cli.Command) error {
107117
err = client.Instances.Delete(
108118
ctx,
109119
instanceID,
120+
deleteParams,
110121
opts...,
111122
)
112123
if err != nil {

0 commit comments

Comments
 (0)