Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-4.6] Bug 1918961: vsphere destroy: delete tag category created by installer #4579

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions pkg/destroy/vsphere/vsphere.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@ func deleteTag(ctx context.Context, client *rest.Client, tagID string) error {
return err
}

func deleteTagCategory(ctx context.Context, client *rest.Client, categoryID string) error {
tagManager := tags.NewManager(client)
category, err := tagManager.GetCategory(ctx, categoryID)
if err == nil {
err = tagManager.DeleteCategory(ctx, category)
}
return err
}

// Run is the entrypoint to start the uninstall process.
func (o *ClusterUninstaller) Run() error {
var folderList []types.ManagedObjectReference
Expand Down Expand Up @@ -207,5 +216,11 @@ func (o *ClusterUninstaller) Run() error {
return err
}

o.Logger.Debug("delete tag category")
if err = deleteTagCategory(context.TODO(), o.RestClient, "openshift-"+o.InfraID); err != nil {
o.Logger.Errorln(err)
return err
}

return nil
}