mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Fix kubectl auth can-i exit errcode
This commit is contained in:
parent
e59ae29fbc
commit
9fa269a5e5
@ -5219,6 +5219,12 @@ runTests() {
|
||||
|
||||
output_message=$(kubectl auth can-i list jobs.batch/bar -n foo --quiet 2>&1 "${kube_flags[@]}")
|
||||
kube::test::if_empty_string "${output_message}"
|
||||
|
||||
output_message=$(kubectl auth can-i get pods --subresource=log 2>&1 "${kube_flags[@]}"; echo $?)
|
||||
kube::test::if_has_string "${output_message}" '0'
|
||||
|
||||
output_message=$(kubectl auth can-i get pods --subresource=log --quiet 2>&1 "${kube_flags[@]}"; echo $?)
|
||||
kube::test::if_has_string "${output_message}" '0'
|
||||
fi
|
||||
|
||||
# kubectl auth reconcile
|
||||
|
@ -97,7 +97,7 @@ func NewCmdCanI(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C
|
||||
|
||||
allowed, err := o.RunAccessCheck()
|
||||
if err == nil {
|
||||
if o.Quiet && !allowed {
|
||||
if !allowed {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user