Skip to content

Commit a4dcfff

Browse files
handle interrupt
1 parent ac8f397 commit a4dcfff

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

cmd/nodecmd/create.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ func createNodes(cmd *cobra.Command, args []string) error {
479479
if err != nil {
480480
return err
481481
}
482+
fmt.Printf("obtained image ID %s \n", imageID)
482483
numNodesMetricsMap = numNodesMap
483484
if existingMonitoringInstance == "" {
484485
monitoringHostRegion = maps.Keys(numNodesMap)[0]

cmd/nodecmd/wiz.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ package nodecmd
44

55
import (
66
"fmt"
7+
"os"
8+
"os/signal"
79
"strconv"
810
"strings"
911
"sync"
12+
"syscall"
1013
"time"
1114

1215
"github.com/ava-labs/avalanche-cli/pkg/metrics"
@@ -145,6 +148,16 @@ The node wiz command creates a devnet and deploys, sync and validate a subnet in
145148
}
146149

147150
func wiz(cmd *cobra.Command, args []string) error {
151+
c := make(chan os.Signal, 1)
152+
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
153+
go func() {
154+
for sig := range c {
155+
fmt.Printf("Received signal: %s\n", sig)
156+
// Perform cleanup or other necessary tasks
157+
fmt.Println("Cleaning up and exiting...")
158+
os.Exit(0)
159+
}
160+
}()
148161
clusterName := args[0]
149162
subnetName := ""
150163
if len(args) > 1 {

pkg/cloud/gcp/gcp.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,6 @@ func (c *GcpCloud) SetupInstances(
321321
return instances, nil
322322
}
323323

324-
// // Copyright (C) 2022, Ava Labs, Inc. All rights reserved.
325-
// // See the file LICENSE for licensing terms.
326-
327324
func (c *GcpCloud) GetUbuntuImageID() (string, error) {
328325
imageListCall := c.gcpClient.Images.List(constants.GCPDefaultImageProvider).Filter(constants.GCPImageFilter)
329326
imageList, err := imageListCall.Do()

0 commit comments

Comments
 (0)