Skip to content

Commit

Permalink
Fix oc policy remove-user to remove rolebindings too
Browse files Browse the repository at this point in the history
Followup to openshift#18102

Signed-off-by: Simo Sorce <[email protected]>
  • Loading branch information
simo5 committed Feb 9, 2018
1 parent 073bb37 commit 63d2cfd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/oc/admin/policy/remove_from_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ func (o *RemoveFromProjectOptions) Run() error {
}

if !o.DryRun {
_, err = o.Client.RoleBindings(o.BindingNamespace).Update(&currBinding)
if len(currBinding.Subjects) > 0 {
_, err = o.Client.RoleBindings(o.BindingNamespace).Update(&currBinding)
} else {
_, err = o.Client.RoleBindings(o.BindingNamespace).Delete(currBinding.Name, &metav1.DeleteOptions{})
}
if err != nil {
return err
}
Expand Down

0 comments on commit 63d2cfd

Please sign in to comment.