Trim password if from executable output
This commit is contained in:
parent
87c86a8090
commit
54fb7b3be3
1 changed files with 6 additions and 1 deletions
|
@ -7,6 +7,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"git.lattuga.net/blallo/papero/worker"
|
"git.lattuga.net/blallo/papero/worker"
|
||||||
"github.com/mitchellh/go-homedir"
|
"github.com/mitchellh/go-homedir"
|
||||||
|
@ -178,7 +179,11 @@ func validatePort(port int) (int, error) {
|
||||||
|
|
||||||
func getPassword(connection *connectionInfo) (string, error) {
|
func getPassword(connection *connectionInfo) (string, error) {
|
||||||
if connection.PasswordExec.Present() {
|
if connection.PasswordExec.Present() {
|
||||||
return connection.PasswordExec.Run()
|
pass, err := connection.PasswordExec.Run()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return strings.TrimRight(pass, "\n"), nil
|
||||||
}
|
}
|
||||||
if connection.PasswordFile != "" {
|
if connection.PasswordFile != "" {
|
||||||
file, err := os.Open(connection.PasswordFile)
|
file, err := os.Open(connection.PasswordFile)
|
||||||
|
|
Loading…
Reference in a new issue