Skip to content

Commit 62c9478

Browse files
committed
fix grid cli deployments conflict when deploying with node id
1 parent 2f8fbe5 commit 62c9478

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

grid-cli/cmd/deploy_vm.go

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"context"
66
"fmt"
77
"os"
8+
"slices"
89

910
"github.com/pkg/errors"
1011
"github.com/rs/zerolog/log"
@@ -130,7 +131,16 @@ var deployVMCmd = &cobra.Command{
130131
}
131132

132133
// if no public ips or yggdrasil then we should go for the light deployment
133-
if !ipv4 && !ipv6 && !ygg {
134+
isLight := !ipv4 && !ipv6 && !ygg
135+
136+
if node != 0 {
137+
isLight, err = isZos4Node(context.Background(), t, node)
138+
if err != nil {
139+
log.Fatal().Err(err).Send()
140+
}
141+
}
142+
143+
if isLight {
134144
vm := workloads.VMLight{
135145
Name: name,
136146
EnvVars: env,
@@ -321,3 +331,16 @@ func executeVMLight(
321331

322332
return nil
323333
}
334+
335+
func isZos4Node(ctx context.Context, tf deployer.TFPluginClient, node uint32) (isLight bool, err error) {
336+
cli, err := tf.NcPool.GetNodeClient(tf.SubstrateConn, node)
337+
if err != nil {
338+
return
339+
}
340+
feat, err := cli.SystemGetNodeFeatures(ctx)
341+
if err != nil {
342+
return
343+
}
344+
345+
return slices.Contains(feat, zos.NetworkLightType), nil
346+
}

0 commit comments

Comments
 (0)