From 402e28d845e21080482bb3f64157246ac37ee9ed Mon Sep 17 00:00:00 2001 From: Pawel Kosiec Date: Thu, 10 Aug 2023 16:23:22 +0200 Subject: [PATCH] Fix counting plugins migrated via `migrate` command --- internal/cli/migrate/migrate.go | 9 +++++++-- internal/executor/doctor/executor.go | 30 +++++++++++++++------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/internal/cli/migrate/migrate.go b/internal/cli/migrate/migrate.go index 8767b09e9b..42cfbf5f51 100644 --- a/internal/cli/migrate/migrate.go +++ b/internal/cli/migrate/migrate.go @@ -67,10 +67,15 @@ func migrate(ctx context.Context, status *printer.StatusPrinter, opts Options, b if err != nil { return "", errors.Wrap(err, "while converting plugins") } - status.Step("Converted %d plugins", len(plugins)) + + pluginsCount := 0 + if len(plugins) != 0 || len(plugins[0].Groups) != 0 { + pluginsCount = len(plugins[0].Groups) + } + status.Step("Converted %d plugins", pluginsCount) actions := converter.ConvertActions(botkubeClusterConfig.Actions) - status.Step("Converted %d action", len(actions)) + status.Step("Converted %d actions", len(actions)) platforms := converter.ConvertPlatforms(botkubeClusterConfig.Communications) status.Step(`Converted platforms: diff --git a/internal/executor/doctor/executor.go b/internal/executor/doctor/executor.go index cad4e2d015..6a860de880 100644 --- a/internal/executor/doctor/executor.go +++ b/internal/executor/doctor/executor.go @@ -50,20 +50,22 @@ func (d *Executor) Metadata(context.Context) (api.MetadataOutput, error) { Description: "Doctor is a ChatGPT integration project that knows how to diagnose Kubernetes problems and suggest solutions.", JSONSchema: api.JSONSchema{ Value: heredoc.Doc(`{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "doctor", - "description": "Doctor is a ChatGPT integration project that knows how to diagnose Kubernetes problems and suggest solutions.", - "type": "object", - "properties": { - "apiKey": { - "description": "API Key", - "type": "string" - "title": "OpenAI API Key" - } - }, - "required": ["apiKey"], - "additionalProperties": false - }`), + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "doctor", + "description": "Doctor is a ChatGPT integration project that knows how to diagnose Kubernetes problems and suggest solutions.", + "type": "object", + "properties": { + "apiKey": { + "description": "API Key", + "type": "string", + "title": "OpenAI API Key" + } + }, + "required": [ + "apiKey" + ], + "additionalProperties": false + }`), }, }, nil }