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 oc annotate to allow use of --resource-version flag with single rsrc #9917

Conversation

juanvallejo
Copy link
Contributor

@juanvallejo juanvallejo commented Jul 18, 2016

fixes #9908
Upstream: kubernetes/kubernetes#29319
Related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1257853

When using annotate with a --resource-version on a resource, such as oc annotate pod <pod_name> --resource-version=1820 description='myannotation', the command fails with the error: error: --resource-version may only be used with a single resource.

Upon printing the output of resources that the annotate command receives from cli args, it prints: Resources:[pod <pod_name>]. In other words, it treats the name of the resource as a second resource. This PR addresses this issue by using the resource builder Singular flag to determine if only a single resource was passed.

@juanvallejo
Copy link
Contributor Author

[test]

}

// number of resources found
numResources := len(rInfos)
Copy link
Contributor

Choose a reason for hiding this comment

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

This check is not correct, you need to use the Singular flag.

Copy link
Contributor

Choose a reason for hiding this comment

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

Getting 1 item back from oc get pods should not trigger this behavior. resource.Builder tracks whether the user asks for oc get pods bar via the Singular flag.

@juanvallejo juanvallejo force-pushed the jvallejo_fix-resource-version-flag-bug branch from bf3fbd3 to b039ed9 Compare July 19, 2016 14:41
@juanvallejo
Copy link
Contributor Author

re[test]

@juanvallejo
Copy link
Contributor Author

flake re[test]

1 similar comment
@juanvallejo
Copy link
Contributor Author

flake re[test]

@juanvallejo
Copy link
Contributor Author

re[test]

@juanvallejo juanvallejo force-pushed the jvallejo_fix-resource-version-flag-bug branch from b039ed9 to 23b68f0 Compare July 20, 2016 20:29
@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 23b68f0

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/6611/)

@juanvallejo
Copy link
Contributor Author

@fabianofranz Could you please take a look?

@fabianofranz
Copy link
Member

LGTM [merge]

@openshift-bot
Copy link
Contributor

openshift-bot commented Jul 22, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/6611/) (Image: devenv-rhel7_4649)

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 23b68f0

@openshift-bot openshift-bot merged commit e771bf6 into openshift:master Jul 23, 2016
@juanvallejo juanvallejo deleted the jvallejo_fix-resource-version-flag-bug branch July 25, 2016 13:14
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.

oc annotate fails when used with --resource-version
4 participants