... | ... |
@@ -432,7 +432,7 @@ func (c *ClientStartConfig) CheckExistingOpenShiftContainer(out io.Writer) error |
432 | 432 |
return errors.NewError("unexpected error while checking OpenShift container state").WithCause(err) |
433 | 433 |
} |
434 | 434 |
if running { |
435 |
- return errors.NewError("OpenShift is already running").WithSolution("To start OpenShift again, stop current %q container.", openShiftContainer) |
|
435 |
+ return errors.NewError("OpenShift is already running").WithSolution("To start OpenShift again, stop the current cluster:\n$ %s\n", cmdutil.SiblingCommand(c.command, "down")) |
|
436 | 436 |
} |
437 | 437 |
if exists { |
438 | 438 |
err = c.DockerHelper().RemoveContainer(openShiftContainer) |
... | ... |
@@ -13,6 +13,7 @@ import ( |
13 | 13 |
kerrors "k8s.io/kubernetes/pkg/util/errors" |
14 | 14 |
"k8s.io/kubernetes/pkg/util/sets" |
15 | 15 |
|
16 |
+ cmdutil "github.com/openshift/origin/pkg/cmd/util" |
|
16 | 17 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
17 | 18 |
) |
18 | 19 |
|
... | ... |
@@ -33,7 +34,7 @@ var rshExcludeFlags = sets.NewString("delete", "strategy", "quiet", "include", " |
33 | 33 |
|
34 | 34 |
func newRsyncStrategy(f *clientcmd.Factory, c *cobra.Command, o *RsyncOptions) (copyStrategy, error) { |
35 | 35 |
// Determine the rsh command to pass to the local rsync command |
36 |
- rsh := siblingCommand(c, "rsh") |
|
36 |
+ rsh := cmdutil.SiblingCommand(c, "rsh") |
|
37 | 37 |
rshCmd := []string{rsh} |
38 | 38 |
// Append all original flags to rsh command |
39 | 39 |
c.Flags().Visit(func(flag *pflag.Flag) { |
... | ... |
@@ -3,13 +3,10 @@ package rsync |
3 | 3 |
import ( |
4 | 4 |
"bytes" |
5 | 5 |
"fmt" |
6 |
- "os" |
|
7 | 6 |
"os/exec" |
8 | 7 |
"runtime" |
9 |
- "strings" |
|
10 | 8 |
|
11 | 9 |
"github.com/golang/glog" |
12 |
- "github.com/spf13/cobra" |
|
13 | 10 |
kclient "k8s.io/kubernetes/pkg/client/unversioned" |
14 | 11 |
) |
15 | 12 |
|
... | ... |
@@ -41,27 +38,6 @@ func hasLocalRsync() bool { |
41 | 41 |
return true |
42 | 42 |
} |
43 | 43 |
|
44 |
-// siblingCommand returns a sibling command to the current command |
|
45 |
-func siblingCommand(cmd *cobra.Command, name string) string { |
|
46 |
- c := cmd.Parent() |
|
47 |
- command := []string{} |
|
48 |
- for c != nil { |
|
49 |
- glog.V(5).Infof("Found parent command: %s", c.Name()) |
|
50 |
- command = append([]string{c.Name()}, command...) |
|
51 |
- c = c.Parent() |
|
52 |
- } |
|
53 |
- // Replace the root command with what was actually used |
|
54 |
- // in the command line |
|
55 |
- glog.V(4).Infof("Setting root command to: %s", os.Args[0]) |
|
56 |
- command[0] = os.Args[0] |
|
57 |
- |
|
58 |
- // Append the sibling command |
|
59 |
- command = append(command, name) |
|
60 |
- glog.V(4).Infof("The sibling command is: %s", strings.Join(command, " ")) |
|
61 |
- |
|
62 |
- return strings.Join(command, " ") |
|
63 |
-} |
|
64 |
- |
|
65 | 44 |
func isExitError(err error) bool { |
66 | 45 |
if err == nil { |
67 | 46 |
return false |
68 | 47 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,30 @@ |
0 |
+package util |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "os" |
|
4 |
+ "strings" |
|
5 |
+ |
|
6 |
+ "github.com/golang/glog" |
|
7 |
+ "github.com/spf13/cobra" |
|
8 |
+) |
|
9 |
+ |
|
10 |
+// SiblingCommand returns a sibling command to the given command |
|
11 |
+func SiblingCommand(cmd *cobra.Command, name string) string { |
|
12 |
+ c := cmd.Parent() |
|
13 |
+ command := []string{} |
|
14 |
+ for c != nil { |
|
15 |
+ glog.V(5).Infof("Found parent command: %s", c.Name()) |
|
16 |
+ command = append([]string{c.Name()}, command...) |
|
17 |
+ c = c.Parent() |
|
18 |
+ } |
|
19 |
+ // Replace the root command with what was actually used |
|
20 |
+ // in the command line |
|
21 |
+ glog.V(4).Infof("Setting root command to: %s", os.Args[0]) |
|
22 |
+ command[0] = os.Args[0] |
|
23 |
+ |
|
24 |
+ // Append the sibling command |
|
25 |
+ command = append(command, name) |
|
26 |
+ glog.V(4).Infof("The sibling command is: %s", strings.Join(command, " ")) |
|
27 |
+ |
|
28 |
+ return strings.Join(command, " ") |
|
29 |
+} |