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 <ccole...@redhat.com> 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. > > > > On Wed, Jun 21, 2017 at 9:38 AM, Ben Parees <bpar...@redhat.com> wrote: > >> >> >> On Wed, Jun 21, 2017 at 9:31 AM, Clayton Coleman <ccole...@redhat.com> >> 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" returning an error in this case prevent using it >> in scripting effectively? it would just mean the script would fail one >> command earlier (before the bad token was used). Seems like that would be >> the more useful behavior in terms of understanding what failed in the >> script, too. >> >> >> >> >>> >>> On Jun 21, 2017, at 7:49 AM, Philippe Lafoucrière < >>> philippe.lafoucri...@tech-angels.com> wrote: >>> >>> 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 >>> users@lists.openshift.redhat.com >>> http://lists.openshift.redhat.com/openshiftmm/listinfo/users >>> >>> >>> _______________________________________________ >>> users mailing list >>> users@lists.openshift.redhat.com >>> http://lists.openshift.redhat.com/openshiftmm/listinfo/users >>> >>> >> >> >> -- >> Ben Parees | OpenShift >> >> >
_______________________________________________ users mailing list users@lists.openshift.redhat.com http://lists.openshift.redhat.com/openshiftmm/listinfo/users