Skip to content

Commit

Permalink
Merge pull request #28 from ibuildthecloud/fixes5
Browse files Browse the repository at this point in the history
Small fixes
  • Loading branch information
ibuildthecloud authored Nov 17, 2016
2 parents 13a472e + c12deb0 commit 1c50de1
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func runDockerWithOutput(hostname string, c *client.RancherClient, args []string
}

state := getHostState(host)
if state != "active" && state != "inactive" {
if state != "active" && state != "inactive" && state != "disconnected" {
return fmt.Errorf("Can not contact host %s in state %s", hostname, state)
}

Expand Down
1 change: 1 addition & 0 deletions cmd/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func HostCommand() cli.Command {
hostLsFlags := []cli.Flag{
listAllFlag(),
cli.BoolFlag{
Name: "quiet,q",
Usage: "Only display IDs",
Expand Down
2 changes: 1 addition & 1 deletion cmd/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func resolveContainers(c *client.RancherClient, names []string) ([]client.Instan
result := []client.Instance{}

for _, name := range names {
resource, err := Lookup(c, name, "container", "service", "stack")
resource, err := Lookup(c, name, "container", "service")
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

var (
rmTypes = []string{"service", "container", "stack", "host", "machine", "volume"}
rmTypes = []string{"service", "container", "stack", "host", "volume"}
)

func RmCommand() cli.Command {
Expand Down
18 changes: 12 additions & 6 deletions cmd/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ import (

func SSHCommand() cli.Command {
return cli.Command{
Name: "ssh",
Usage: "SSH into host",
Description: "\nFor any hosts created through Rancher using docker-machine, you can SSH into the host. This is not supported for any custom hosts. If the host is not in the current $RANCHER_ENVIRONMENT, use `--env <envID>` or `--env <envName>` to select a different environment.\n\nExample:\n\t$ rancher ssh 1h1\n\t$ rancher --env 1a5 ssh 1h5\n",
ArgsUsage: "[HOSTID HOSTNAME...]",
Action: hostSSH,
Flags: []cli.Flag{},
Name: "ssh",
Usage: "SSH into host",
Description: "\nFor any hosts created through Rancher using docker-machine, you can SSH into the host. This is not supported for any custom hosts. If the host is not in the current $RANCHER_ENVIRONMENT, use `--env <envID>` or `--env <envName>` to select a different environment.\n\nExample:\n\t$ rancher ssh 1h1\n\t$ rancher --env 1a5 ssh 1h5\n",
ArgsUsage: "[HOSTID HOSTNAME...]",
Action: hostSSH,
Flags: []cli.Flag{},
SkipFlagParsing: true,
}
}

Expand All @@ -36,6 +37,10 @@ func hostSSH(ctx *cli.Context) error {
hostname := ""
args := ctx.Args()

if len(args) > 0 && (args[0] == "-h" || args[0] == "--help") {
return cli.ShowCommandHelp(ctx, "ssh")
}

for _, arg := range args {
if len(arg) > 0 && arg[0] != '-' {
parts := strings.SplitN(arg, "@", 2)
Expand Down Expand Up @@ -86,6 +91,7 @@ func callSSH(content []byte, ip string, args []string) error {
parts := strings.SplitN(val, "@", 2)
parts[len(parts)-1] = ip
args[i] = strings.Join(parts, "@")
break
}
}

Expand Down

0 comments on commit 1c50de1

Please sign in to comment.