Commit 9fa269a5 authored by Borja Aranda's avatar Borja Aranda

Fix kubectl auth can-i exit errcode

parent e59ae29f
...@@ -5219,6 +5219,12 @@ runTests() { ...@@ -5219,6 +5219,12 @@ runTests() {
output_message=$(kubectl auth can-i list jobs.batch/bar -n foo --quiet 2>&1 "${kube_flags[@]}") output_message=$(kubectl auth can-i list jobs.batch/bar -n foo --quiet 2>&1 "${kube_flags[@]}")
kube::test::if_empty_string "${output_message}" 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 fi
# kubectl auth reconcile # kubectl auth reconcile
......
...@@ -97,7 +97,7 @@ func NewCmdCanI(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C ...@@ -97,7 +97,7 @@ func NewCmdCanI(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C
allowed, err := o.RunAccessCheck() allowed, err := o.RunAccessCheck()
if err == nil { if err == nil {
if o.Quiet && !allowed { if !allowed {
os.Exit(1) os.Exit(1)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment