Skip to content

Commit

Permalink
expand parseAdressess args
Browse files Browse the repository at this point in the history
  • Loading branch information
seletskiy committed Jun 10, 2016
1 parent f12a36e commit b4933e0
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,16 +539,21 @@ func connectAndLock(
canceler *sync.Cond,
) (*distributedLock, error) {
var (
hosts = args["--host"].([]string)

sendTimeout = args["--send-timeout"].(string)
defaultUser = args["--user"].(string)

noLockFail = args["--no-lock-fail"].(bool)
askPassword = args["--password"].(bool)
fromStdin = args["--read-stdin"].(bool)

rootDir, _ = args["--root"].(string)
sshKeyPath, _ = args["--key"].(string)
lockFile, _ = args["--lock-file"].(string)
)

addresses, err := parseAddresses(args)
addresses, err := parseAddresses(hosts, defaultUser, fromStdin)
if err != nil {
return nil, hierr.Errorf(
err,
Expand Down Expand Up @@ -650,13 +655,11 @@ func createRunnerFactory(
)
}

func parseAddresses(args map[string]interface{}) ([]address, error) {
var (
defaultUser = args["--user"].(string)
hosts = args["--host"].([]string)
fromStdin = args["--read-stdin"].(bool)
)

func parseAddresses(
hosts []string,
defaultUser string,
fromStdin bool,
) ([]address, error) {
var (
hostsToParse = []string{}
)
Expand Down

0 comments on commit b4933e0

Please sign in to comment.