Bug 1853367

Summary: virtctl does not report authentication errors
Product: Container Native Virtualization (CNV) Reporter: Lars Kellogg-Stedman <lars>
Component: VirtualizationAssignee: Igor Bezukh <ibezukh>
Status: CLOSED NOTABUG QA Contact: Israel Pinto <ipinto>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.3.0CC: cnv-qe-bugs, ibezukh
Target Milestone: ---   
Target Release: 2.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-27 02:41:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lars Kellogg-Stedman 2020-07-02 13:55:13 UTC
Description of problem:

When virtctl fails due to authentication problems, the error messages presented to the user are misleading.

Version-Release number of selected component (if applicable):

$ rpm -q kubevirt-virtctl
kubevirt-virtctl-0.26.1-15.el8.x86_64

$ virtctl version
Client Version: version.Info{GitVersion:"v0.26.1", GitCommit:"e40ff7965e2aadbf21131626dfa3be85524e3a2c", GitTreeState:"clean", BuildDate:"2020-02-19T16:16:36Z", GoVersion:"go1.12.8", Compiler:"gc", Platform:"linux/amd64"}
the server could not find the requested resource


How reproducible:

Run virtctl commands without credentials configured.


Steps to Reproduce:
1. Run a command that requires credentials, for example:

virtctl image-upload dv larsdv4 --image-path cirros-0.5.1-x86_64-disk.img --size 1G --storage-class hostpath-provisioner --insecure

2. The command fails with:

the server could not find the requested resource (post datavolumes.cdi.kubevirt.io)

Actual results:

the server could not find the requested resource (post datavolumes.cdi.kubevirt.io)


Expected results:

An error message along the lines of "This command requires authentication".

Comment 2 Igor Bezukh 2020-07-21 06:06:55 UTC
I was unable to reproduce the issue. I've reduced the auth token timeout to 30 secs. Running virtctl after 20 secs returned "Unauthorized" string. Same 
for the command mentioned in the reproduction steps.
Lars, can you please elaborate about the way you made the setup unauthenticated?

Comment 3 Lars Kellogg-Stedman 2020-07-27 02:41:51 UTC
Yeah, I think something else was going on. Sorry for the noise.