Merged by openshift-bot
OpenShift Bot authored on 2016/06/24 02:00:44... | ... |
@@ -65,7 +65,7 @@ func NewCommandAdmin(name, fullName string, out io.Writer, errout io.Writer) *co |
65 | 65 |
Commands: []*cobra.Command{ |
66 | 66 |
buildchain.NewCmdBuildChain(name, fullName+" "+buildchain.BuildChainRecommendedCommandName, f, out), |
67 | 67 |
diagnostics.NewCmdDiagnostics(diagnostics.DiagnosticsRecommendedName, fullName+" "+diagnostics.DiagnosticsRecommendedName, out), |
68 |
- node.NewCommandManageNode(f, node.ManageNodeCommandName, fullName+" "+node.ManageNodeCommandName, out), |
|
68 |
+ node.NewCommandManageNode(f, node.ManageNodeCommandName, fullName+" "+node.ManageNodeCommandName, out, errout), |
|
69 | 69 |
prune.NewCommandPrune(prune.PruneRecommendedName, fullName+" "+prune.PruneRecommendedName, f, out), |
70 | 70 |
}, |
71 | 71 |
}, |
... | ... |
@@ -115,7 +115,7 @@ func (e *EvacuateOptions) RunEvacuate(node *kapi.Node) error { |
115 | 115 |
} |
116 | 116 |
|
117 | 117 |
if firstPod { |
118 |
- fmt.Fprint(e.Options.Writer, "\nMigrating these pods on node: ", node.ObjectMeta.Name, "\n\n") |
|
118 |
+ fmt.Fprint(e.Options.ErrWriter, "\nMigrating these pods on node: ", node.ObjectMeta.Name, "\n\n") |
|
119 | 119 |
firstPod = false |
120 | 120 |
printerWithHeaders.PrintObj(&pod, e.Options.Writer) |
121 | 121 |
} else { |
... | ... |
@@ -1,9 +1,10 @@ |
1 | 1 |
package node |
2 | 2 |
|
3 | 3 |
import ( |
4 |
- "github.com/spf13/cobra" |
|
5 | 4 |
"strconv" |
6 | 5 |
"testing" |
6 |
+ |
|
7 |
+ "github.com/spf13/cobra" |
|
7 | 8 |
) |
8 | 9 |
|
9 | 10 |
func TestEvacuateFlags(t *testing.T) { |
... | ... |
@@ -27,7 +28,7 @@ func TestEvacuateFlags(t *testing.T) { |
27 | 27 |
}, |
28 | 28 |
} |
29 | 29 |
|
30 |
- cmd := NewCommandManageNode(nil, ManageNodeCommandName, ManageNodeCommandName, nil) |
|
30 |
+ cmd := NewCommandManageNode(nil, ManageNodeCommandName, ManageNodeCommandName, nil, nil) |
|
31 | 31 |
for _, v := range tests { |
32 | 32 |
testFlag(cmd, v.flagName, v.defaultVal, t) |
33 | 33 |
} |
... | ... |
@@ -61,7 +61,7 @@ func (l *ListPodsOptions) runListPods(node *kapi.Node, printer kubectl.ResourceP |
61 | 61 |
if err != nil { |
62 | 62 |
return err |
63 | 63 |
} |
64 |
- fmt.Fprint(l.Options.Writer, "\nListing matched pods on node: ", node.ObjectMeta.Name, "\n\n") |
|
64 |
+ fmt.Fprint(l.Options.ErrWriter, "\nListing matched pods on node: ", node.ObjectMeta.Name, "\n\n") |
|
65 | 65 |
printer.PrintObj(pods, l.Options.Writer) |
66 | 66 |
|
67 | 67 |
return err |
... | ... |
@@ -46,7 +46,7 @@ list-pods: List all/selected pods on given/selected nodes. It can list the outpu |
46 | 46 |
var schedulable, evacuate, listpods bool |
47 | 47 |
|
48 | 48 |
// NewCommandManageNode implements the OpenShift cli manage-node command |
49 |
-func NewCommandManageNode(f *clientcmd.Factory, commandName, fullName string, out io.Writer) *cobra.Command { |
|
49 |
+func NewCommandManageNode(f *clientcmd.Factory, commandName, fullName string, out, errout io.Writer) *cobra.Command { |
|
50 | 50 |
opts := &NodeOptions{} |
51 | 51 |
schedulableOp := &SchedulableOptions{Options: opts} |
52 | 52 |
evacuateOp := NewEvacuateOptions(opts) |
... | ... |
@@ -63,7 +63,7 @@ func NewCommandManageNode(f *clientcmd.Factory, commandName, fullName string, ou |
63 | 63 |
kcmdutil.CheckErr(kcmdutil.UsageError(c, err.Error())) |
64 | 64 |
} |
65 | 65 |
|
66 |
- if err := opts.Complete(f, c, args, out); err != nil { |
|
66 |
+ if err := opts.Complete(f, c, args, out, errout); err != nil { |
|
67 | 67 |
kcmdutil.CheckErr(err) |
68 | 68 |
} |
69 | 69 |
|
... | ... |
@@ -28,6 +28,7 @@ type NodeOptions struct { |
28 | 28 |
DefaultNamespace string |
29 | 29 |
Kclient *client.Client |
30 | 30 |
Writer io.Writer |
31 |
+ ErrWriter io.Writer |
|
31 | 32 |
|
32 | 33 |
Mapper meta.RESTMapper |
33 | 34 |
Typer runtime.ObjectTyper |
... | ... |
@@ -44,7 +45,7 @@ type NodeOptions struct { |
44 | 44 |
PodSelector string |
45 | 45 |
} |
46 | 46 |
|
47 |
-func (n *NodeOptions) Complete(f *clientcmd.Factory, c *cobra.Command, args []string, out io.Writer) error { |
|
47 |
+func (n *NodeOptions) Complete(f *clientcmd.Factory, c *cobra.Command, args []string, out, errout io.Writer) error { |
|
48 | 48 |
defaultNamespace, _, err := f.DefaultNamespace() |
49 | 49 |
if err != nil { |
50 | 50 |
return err |
... | ... |
@@ -62,6 +63,7 @@ func (n *NodeOptions) Complete(f *clientcmd.Factory, c *cobra.Command, args []st |
62 | 62 |
n.DefaultNamespace = defaultNamespace |
63 | 63 |
n.Kclient = kc |
64 | 64 |
n.Writer = out |
65 |
+ n.ErrWriter = errout |
|
65 | 66 |
n.Mapper = mapper |
66 | 67 |
n.Typer = typer |
67 | 68 |
n.RESTClientFactory = f.Factory.ClientForMapping |