Re: oc whoami bug?

2017-06-21 Thread Jordan Liggitt
It doesn't give you an anonymous token. It gives you the current token held by oc, which the server may or may not consider valid. On Wed, Jun 21, 2017 at 1:47 PM, Ben Parees wrote: > > > On Wed, Jun 21, 2017 at 12:30 PM, Clayton Coleman > wrote: > >>

Re: oc whoami bug?

2017-06-21 Thread Ben Parees
On Wed, Jun 21, 2017 at 12:30 PM, Clayton Coleman wrote: > If your script looks like: > > $ oc get service foo --token "$(oc whoami -t)" > > and whoami -t fails you're going to get something you didn't expect as > output. > if it succeeds and gives you an anonymous token

Re: oc whoami bug?

2017-06-21 Thread Clayton Coleman
If you're looking for a "am I authenticated" script element, generally I would recommend doing: $ oc get user/~ -o name --token "$(oc whoami -t)" On Wed, Jun 21, 2017 at 12:30 PM, Clayton Coleman wrote: > If your script looks like: > > $ oc get service foo --token "$(oc

Re: oc whoami bug?

2017-06-21 Thread Clayton Coleman
If your script looks like: $ oc get service foo --token "$(oc whoami -t)" and whoami -t fails you're going to get something you didn't expect as output. On Wed, Jun 21, 2017 at 9:38 AM, Ben Parees wrote: > > > On Wed, Jun 21, 2017 at 9:31 AM, Clayton Coleman

Re: oc whoami bug?

2017-06-21 Thread Aleksandar Lazic
Title: Re: oc whoami bug? Hi Philippe Lafoucrière. on Mittwoch, 21. Juni 2017 at 13:48 was written: Just to be clear, my point is: if `oc whoami` returns "error: You must be logged in to the server (the server has asked for the client to provide credentials)", `oc whoami -t` sho

Re: oc whoami bug?

2017-06-21 Thread Ben Parees
On Wed, Jun 21, 2017 at 9:31 AM, Clayton Coleman wrote: > The reason today it does not do that so you can use it in scripting > effectively. It's expected you're using that immediately in another > command which would display that error. > why would "oc whoami -t"

Re: oc whoami bug?

2017-06-21 Thread Clayton Coleman
The reason today it does not do that so you can use it in scripting effectively. It's expected you're using that immediately in another command which would display that error. On Jun 21, 2017, at 7:49 AM, Philippe Lafoucrière < philippe.lafoucri...@tech-angels.com> wrote: Just to be clear, my

Re: oc whoami bug?

2017-06-21 Thread Philippe Lafoucrière
Just to be clear, my point is: if `oc whoami` returns "error: You must be logged in to the server (the server has asked for the client to provide credentials)", `oc whoami -t` should return the same if the session has timed out ;)​ ___ users mailing list

Re: oc whoami bug?

2017-06-20 Thread Louis Santillan
Whoops. Hit the Send button early. $ ocx () { ( oc project >/dev/null 2>&1 ) && oc $@ || echo "ERROR: You may not be logged in!" ; } $ ocx get pods -o wide --- LOUIS P. SANTILLAN SENIOR CONSULTANT, OPENSHIFT, MIDDLEWARE &

Re: oc whoami bug?

2017-06-20 Thread Louis Santillan
$ ocx () { oc project 2&>/dev/null && oc $@ || echo "ERROR: You may not be logged in!" ; } $ ocx get pods -o wide --- LOUIS P. SANTILLAN SENIOR CONSULTANT, OPENSHIFT, MIDDLEWARE & DEVOPS Red Hat Consulting, NA US WEST

Re: oc whoami bug?

2017-06-20 Thread Louis Santillan
The `oc` command always looks for the current session in `~/.kube/config`. It doesn't know if a session is expired or not since session timeouts are configurable and could have changed since the last API call was made to the master(s). You can run your `oc` commands to with `--loglevel=8` to see

Re: oc whoami bug?

2017-06-20 Thread Philippe Lafoucrière
On Mon, Jun 19, 2017 at 4:56 PM, Louis Santillan wrote: > The default user for any request is `system:anonymous` a user is not > logged in or a valid token is not found. Depending on your cluster, this > usually has almost no access (less than `system:authenticated`).

Re: oc whoami bug?

2017-06-19 Thread Louis Santillan
The default user for any request is `system:anonymous` a user is not logged in or a valid token is not found. Depending on your cluster, this usually has almost no access (less than `system:authenticated`). Maybe an RFE is order (oc could suggest logging in if request is unsuccessful and the

oc whoami bug?

2017-06-19 Thread Philippe Lafoucrière
Hi, I think I have hit a bug (or a lack of warning message) with `oc whoami -t`: I tried to login on our registry, and only got "unauthorized: authentication required" responses. After a couple of tries, I launched `oc whoami` without -t: "error: You must be logged in to the server (the server