Skip to content

Commit e22a02a

Browse files
authored
Merge pull request #3843 from neolit123/3834-fix-tree-cmd-bug
ws command: skip tree on workspaces that are being deleted
2 parents 2bc000f + 9852962 commit e22a02a

File tree

1 file changed

+8
-0
lines changed
  • staging/src/github.com/kcp-dev/cli/pkg/workspace/plugin

1 file changed

+8
-0
lines changed

staging/src/github.com/kcp-dev/cli/pkg/workspace/plugin/tree.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ func (o *TreeOptions) populateInteractiveNodeBubble(ctx context.Context, node *t
235235
loadAllChildren := node.expanded
236236

237237
for _, ws := range results.Items {
238+
// Skip workspaces that are being deleted, as they may no longer be
239+
// accessible and listing their children could result in a 403.
240+
if ws.DeletionTimestamp != nil {
241+
continue
242+
}
238243
_, childPath, err := pluginhelpers.ParseClusterURL(ws.Spec.URL)
239244
if err != nil {
240245
return fmt.Errorf("workspace URL %q does not point to valid workspace", ws.Spec.URL)
@@ -317,6 +322,9 @@ func (o *TreeOptions) populateBranch(ctx context.Context, tree treeprint.Tree, p
317322
}
318323

319324
for _, workspace := range results.Items {
325+
if workspace.DeletionTimestamp != nil {
326+
continue
327+
}
320328
_, current, err := pluginhelpers.ParseClusterURL(workspace.Spec.URL)
321329
if err != nil {
322330
return fmt.Errorf("current config context URL %q does not point to workspace", workspace.Spec.URL)

0 commit comments

Comments
 (0)