Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update manage-node to support multiple output formats #14655

Merged

Conversation

juanvallejo
Copy link
Contributor

Fixes #14360

Updates ManageNode to follow complete,verify,run pattern
Updates Complete method of NodeOptions to take command printer output format into account

cc @openshift/cli-review @stevekuznetsov

@juanvallejo
Copy link
Contributor Author

[test]

@@ -119,6 +88,41 @@ func NewCommandManageNode(f *clientcmd.Factory, commandName, fullName string, ou
return cmd
}

func (n *NodeOptions) RunManageNode(c *cobra.Command, f *clientcmd.Factory, args []string, evacuateOp *EvacuateOptions, listpodsOp *ListPodsOptions, schedulableOp *SchedulableOptions, out, errout io.Writer) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems awkward. Looks like you would want:

type ManageNodeOptions struct {
    nodeOptions NodeOptions
    evacuateOptions EvacuateOptions
    listPodsOptions ListPodOptions
    schedulableOptions SchedulableOptions

    out io.Writer
    out, errout io.Writer
}

func (n *ManageNodeOptions) Complete(c *cobra.Command, f *clientcmd.Factory, args []string) error {
    return n.nodeOptions.Complete(f, c, args, out, errout)
}

func (n *ManageNodeOptions) RunManageNode(c *cobra.Command, f *clientcmd.Factory, args []string) error {
    // ...
}

Or something like that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks better, will update. Thanks

@juanvallejo juanvallejo force-pushed the jvallejo/fix-manage-node-output branch from ce885e1 to 31c4abd Compare June 14, 2017 22:02
@juanvallejo
Copy link
Contributor Author

@stevekuznetsov thanks, review comment addressed

}

func (n *ManageNodeOptions) RunManageNode(c *cobra.Command) error {
if err := ValidOperation(c); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a Validate?

return kcmdutil.UsageError(c, err.Error())
}

// Cross op validations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also a Validate

@stevekuznetsov
Copy link
Contributor

@dobbymoodge did we edit rosie?
rosie

@dobbymoodge
Copy link
Contributor

dobbymoodge commented Jun 15, 2017 via email

@juanvallejo juanvallejo force-pushed the jvallejo/fix-manage-node-output branch from 31c4abd to 686f83e Compare June 15, 2017 15:44
@juanvallejo
Copy link
Contributor Author

@stevekuznetsov thanks, comments addressed

Copy link
Contributor

@stevekuznetsov stevekuznetsov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@juanvallejo can you show output?

@juanvallejo
Copy link
Contributor Author

juanvallejo commented Jun 15, 2017

@stevekuznetsov

can you show output?

Sure, here's jsonpath and wide output examples:

$ oc adm manage-node dhcp137-149.rdu.redhat.com --schedulable -o jsonpath='{ .metadata.name }'
dhcp137-149.rdu.redhat.com
$ oc adm manage-node dhcp137-149.rdu.redhat.com --schedulable -o wide
NAME                         STATUS    AGE       VERSION             EXTERNAL-IP   OS-IMAGE                          KERNEL-VERSION
dhcp137-149.rdu.redhat.com   Ready     3m        v1.6.1+5115d708d7   <none>        Fedora 25 (Workstation Edition)   4.11.4-200.fc25.x86_64

Evacuate with --dry-run and json output:

$ oc adm manage-node dhcp137-149.rdu.redhat.com --evacuate --dry-run -o json
{
    "Items": null
}

Here are pastebins of yaml and json output.

@stevekuznetsov
Copy link
Contributor

stevekuznetsov commented Jun 15, 2017

Love it.

@juanvallejo
Copy link
Contributor Author

flaked on #13271

@stevekuznetsov
Copy link
Contributor

No, you have a compilation failure:

FAIL	github.com/openshift/origin/pkg/build/controller/build [build failed]

@juanvallejo juanvallejo force-pushed the jvallejo/fix-manage-node-output branch from 686f83e to bd5608b Compare June 15, 2017 18:35
@stevekuznetsov
Copy link
Contributor

[merge][severity: bug]

@juanvallejo
Copy link
Contributor Author

juanvallejo commented Jun 16, 2017

flaked on #13108 re[test]

@juanvallejo
Copy link
Contributor Author

flaked on #10182 re[test]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to bd5608b

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test Running (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/2338/) (Base Commit: ee67917) (PR Branch Commit: bd5608b)

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to bd5608b

@openshift-bot
Copy link
Contributor

openshift-bot commented Jun 17, 2017

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/1027/) (Base Commit: 27afdba) (PR Branch Commit: bd5608b) (Extended Tests: bug) (Image: devenv-rhel7_6374)

@openshift-bot openshift-bot merged commit 8c017d2 into openshift:master Jun 17, 2017
@juanvallejo juanvallejo deleted the jvallejo/fix-manage-node-output branch June 19, 2017 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants