-
Notifications
You must be signed in to change notification settings - Fork 4.7k
UPSTREAM: 34763: log warning on invalid --output-version #11239
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
UPSTREAM: 34763: log warning on invalid --output-version #11239
Conversation
validSpecifiedVersion := (result.GetObjectKind().GroupVersionKind().Version == outputVersion.Version) | ||
outputVersionString := kcmdutil.GetFlagString(cmd, "output-version") | ||
if !validSpecifiedVersion && len(outputVersionString) > 0 { | ||
err = fmt.Errorf("the output version specified (%v) is invalid, defaulting to %v\n", outputVersion, clientConfig.GroupVersion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it would be better to glog
this message instead
ab39188
to
3fc967d
Compare
oc export
add warning on invalid --output-version3fc967d
to
7ef733d
Compare
validSpecifiedVersion := (actualVersion.Version == version.Version) | ||
if !validSpecifiedVersion { | ||
msg := fmt.Sprintf(" info: the output version specified (%v) is invalid, defaulting to %v\n", version.Version, actualVersion.Version) | ||
glog.V(2).Infof("%v", msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need fmt.Sprintf
, glog can take the string and arguments directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback, done!
7ef733d
to
6ae900f
Compare
@juanvallejo needs upstream. |
6ae900f
to
4250ada
Compare
Opened PR here: kubernetes/kubernetes#34763. Also updated warning to be |
@juanvallejo We don't normally use non-leveled glog in the client tools I'd suggest to either keep it as leveled glog or, if you want it to be printed regardless of |
Sounds good, it now prints through |
446a387
to
a01fac4
Compare
[test] |
Object versions default to the current version (v1) when a specified `--output-version` is invalid. This patch adds a warning to loglevel 2 when this is the case. Cases affected are all commands with the `--output-version` option, and anywhere runtime objects are converted to versioned objects. **Example** ``` $ oc get pod <mypod> -o json --output-version=invalid --loglevel=2 1006 14:48:34.090971 25620 result.go:239] info: the output version specified (invalid) is invalid, defaulting to v1 { "kind": "Pod", "apiVersion": "v1", "metadata": { "name": "mypod", "namespace": "openshift", ... ```
a01fac4
to
24eca9f
Compare
@fabianofranz This should now be up to date with upstream! |
Evaluated for origin test up to 24eca9f |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/11023/) (Base Commit: cf6ed4b) |
LGTM [merge] |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/11023/) (Image: devenv-rhel7_5309) |
Evaluated for origin merge up to 24eca9f |
UPSTREAM: kubernetes/kubernetes#34763
Related Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1276564
Object versions default to the current version (v1) when a specified
--output-version
is invalid. This patch logs a warning when this isthe case. Cases affected are all commands with the
--output-version
option, and anywhere runtime objects are converted to versioned objects.
Example
@openshift/cli-review