Fix kubectl auth can-i exit errcode

This commit is contained in:
Borja Aranda 2018-02-08 16:46:11 +01:00
parent e59ae29fbc
commit 9fa269a5e5
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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)
}
}