Add changeport command
This commit is contained in:
4 files changed
+69
-3
No files matched your search
@@ -0,0 +1,15 @@
|
||||
package command
|
||||
|
||||
func (i *Command) RunChangePort() error {
|
||||
return i.runSteps(
|
||||
i.CryosparcmChangePortStep(
|
||||
i.cfg.HostName,
|
||||
i.cfg.CryosparcPath,
|
||||
i.cfg.BasePort,
|
||||
portStart,
|
||||
portEnd,
|
||||
portCount,
|
||||
i.cfg.CryosparcmHelp,
|
||||
),
|
||||
)
|
||||
}
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
portStart uint = 39400 // Start port range to assign new base port
|
||||
portEnd uint = 40000 // End port range to assign new base port
|
||||
portStart uint = 61000 // Start port range to assign new base port
|
||||
portEnd uint = 62000 // End port range to assign new base port
|
||||
portCount uint = 10 // Number of contiguous ports available
|
||||
)
|
||||
|
||||
|
||||
+27
-1
@@ -76,7 +76,6 @@ func (i *Command) CryosparcmCreateUserStep(
|
||||
Message: fmt.Sprintf("Creating CryoSPARC user (instance: %s)", cryosparcpath),
|
||||
CompletedMessage: nil,
|
||||
Condition: func() (bool, error) {
|
||||
|
||||
return true, nil
|
||||
},
|
||||
Prompt: func() *huh.Form {
|
||||
@@ -163,6 +162,33 @@ func (i *Command) CryosparcmCreateUserStep(
|
||||
}
|
||||
}
|
||||
|
||||
func (i *Command) CryosparcmChangePortStep(
|
||||
hostname,
|
||||
cryosparcpath string,
|
||||
port, start, end, count uint,
|
||||
help bool) ui.Step {
|
||||
|
||||
return ui.Step{
|
||||
Message: fmt.Sprintf("Changing base port (instance: %s)", cryosparcpath),
|
||||
CompletedMessage: nil,
|
||||
Exec: func() *exec.Cmd {
|
||||
|
||||
if port == 0 {
|
||||
i.setCryosparcBasePort(hostname, start, end, count)
|
||||
}
|
||||
|
||||
return cryosparcmCmd(
|
||||
hostname,
|
||||
cryosparcpath,
|
||||
"",
|
||||
help,
|
||||
"changeport",
|
||||
strconv.FormatUint(uint64(i.cfg.BasePort), 10),
|
||||
)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// cryosparcm commands Steps
|
||||
// =============================================================================
|
||||
|
||||
Reference in new issue
Block a user