Fix default port update handling
This commit is contained in:
1 parent
a598fdfb13
commit
eb88d0381a
2 files changed
+5
-2
No files matched your search
@@ -140,12 +140,12 @@ func (c *TcpCommand) Run(args []string) int {
|
||||
case "null":
|
||||
opts = append(opts, targets.DefaultDefaultPort())
|
||||
default:
|
||||
length, err := strconv.ParseUint(c.flagDefaultPort, 10, 32)
|
||||
port, err := strconv.ParseUint(c.flagDefaultPort, 10, 32)
|
||||
if err != nil {
|
||||
c.UI.Error(fmt.Sprintf("Error parsing %q: %s", c.flagDefaultPort, err))
|
||||
return 1
|
||||
}
|
||||
opts = append(opts, targets.WithDefaultPort(uint32(length)))
|
||||
opts = append(opts, targets.WithDefaultPort(uint32(port)))
|
||||
}
|
||||
|
||||
targetClient := targets.NewClient(client)
|
||||
|
||||
@@ -240,6 +240,9 @@ func (s Service) updateInRepo(ctx context.Context, scopeId, id string, mask []st
|
||||
if name := item.GetName(); name != nil {
|
||||
opts = append(opts, target.WithName(name.GetValue()))
|
||||
}
|
||||
if item.GetDefaultPort().GetValue() != 0 {
|
||||
opts = append(opts, target.WithDefaultPort(item.GetDefaultPort().GetValue()))
|
||||
}
|
||||
version := item.GetVersion()
|
||||
u, err := target.NewTcpTarget(scopeId, opts...)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user