consistent remote option set

This commit is contained in:
Pavel Vorobyov
2019-09-24 12:22:24 +03:00
parent 233b06de4c
commit 3ff1f17faf
2 changed files with 6 additions and 7 deletions

View File

@@ -318,10 +318,8 @@ func (c *Cli) doexec(mode execMode, argsLine string) {
} }
c.acquirePasswd() c.acquirePasswd()
cmd := string(rest)
remote.SetUser(c.user)
remote.SetRaise(c.raiseType)
remote.SetPassword(c.raisePasswd) remote.SetPassword(c.raisePasswd)
cmd := string(rest)
if c.execConfirm { if c.execConfirm {
fmt.Printf("%s\n", term.Yellow(term.HR(len(cmd)+5))) fmt.Printf("%s\n", term.Yellow(term.HR(len(cmd)+5)))

View File

@@ -93,6 +93,7 @@ func (c *Cli) doUser(name string, argsLine string, args ...string) {
return return
} }
c.user = args[0] c.user = args[0]
remote.SetUser(c.user)
} }
func (c *Cli) doHostlist(name string, argsLine string, args ...string) { func (c *Cli) doHostlist(name string, argsLine string, args ...string) {
@@ -159,6 +160,7 @@ func (c *Cli) doRaise(name string, argsLine string, args ...string) {
// Drop passwd in case of changing raise type // Drop passwd in case of changing raise type
c.raisePasswd = "" c.raisePasswd = ""
} }
remote.SetRaise(c.raiseType)
} }
func (c *Cli) doPasswd(name string, argsLine string, args ...string) { func (c *Cli) doPasswd(name string, argsLine string, args ...string) {
@@ -193,11 +195,13 @@ func (c *Cli) doSSH(name string, argsLine string, args ...string) {
} }
c.acquirePasswd() c.acquirePasswd()
remote.SetPassword(c.raisePasswd)
expr, rest := split([]rune(argsLine)) expr, rest := split([]rune(argsLine))
hosts, err := c.store.HostList([]rune(expr)) hosts, err := c.store.HostList([]rune(expr))
if err != nil { if err != nil {
term.Errorf("Error parsing expression %s: %s\n", expr, err) term.Errorf("Error parsing expression %s: %s\n", string(expr), err)
return return
} }
@@ -206,9 +210,6 @@ func (c *Cli) doSSH(name string, argsLine string, args ...string) {
return return
} }
remote.SetUser(c.user)
remote.SetPassword(c.raisePasswd)
remote.SetRaise(c.raiseType)
cmd := string(rest) cmd := string(rest)
remote.RunSerial(hosts, cmd, 0) remote.RunSerial(hosts, cmd, 0)
} }