Skip to content

Commit c12deb0

Browse files
Small fixes
1 parent d08408b commit c12deb0

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

cmd/docker.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func runDockerWithOutput(hostname string, c *client.RancherClient, args []string
9494
}
9595

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

cmd/host.go

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010

1111
func HostCommand() cli.Command {
1212
hostLsFlags := []cli.Flag{
13+
listAllFlag(),
1314
cli.BoolFlag{
1415
Name: "quiet,q",
1516
Usage: "Only display IDs",

cmd/logs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ func resolveContainers(c *client.RancherClient, names []string) ([]client.Instan
321321
result := []client.Instance{}
322322

323323
for _, name := range names {
324-
resource, err := Lookup(c, name, "container", "service", "stack")
324+
resource, err := Lookup(c, name, "container", "service")
325325
if err != nil {
326326
return nil, err
327327
}

cmd/rm.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
)
99

1010
var (
11-
rmTypes = []string{"service", "container", "stack", "host", "machine", "volume"}
11+
rmTypes = []string{"service", "container", "stack", "host", "volume"}
1212
)
1313

1414
func RmCommand() cli.Command {

cmd/ssh.go

+12-6
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ import (
1818

1919
func SSHCommand() cli.Command {
2020
return cli.Command{
21-
Name: "ssh",
22-
Usage: "SSH into host",
23-
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",
24-
ArgsUsage: "[HOSTID HOSTNAME...]",
25-
Action: hostSSH,
26-
Flags: []cli.Flag{},
21+
Name: "ssh",
22+
Usage: "SSH into host",
23+
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",
24+
ArgsUsage: "[HOSTID HOSTNAME...]",
25+
Action: hostSSH,
26+
Flags: []cli.Flag{},
27+
SkipFlagParsing: true,
2728
}
2829
}
2930

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

40+
if len(args) > 0 && (args[0] == "-h" || args[0] == "--help") {
41+
return cli.ShowCommandHelp(ctx, "ssh")
42+
}
43+
3944
for _, arg := range args {
4045
if len(arg) > 0 && arg[0] != '-' {
4146
parts := strings.SplitN(arg, "@", 2)
@@ -86,6 +91,7 @@ func callSSH(content []byte, ip string, args []string) error {
8691
parts := strings.SplitN(val, "@", 2)
8792
parts[len(parts)-1] = ip
8893
args[i] = strings.Join(parts, "@")
94+
break
8995
}
9096
}
9197

0 commit comments

Comments
 (0)