From 665a069d376576c7da909688478f306242a06330 Mon Sep 17 00:00:00 2001 From: Tejas Shinde <tejasshinde@pf9s-MacBook-Air.local> Date: Fri, 7 Mar 2025 12:22:51 +0530 Subject: [PATCH] These changes are for cloud-ctl error lablels --- pkg/config/config.go | 4 ++-- pkg/util/constants.go | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index cb51ad0..2a2a687 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -25,7 +25,7 @@ import ( var ( REGION_INVALID error = errors.New("Invalid Region") INVALID_CREDS error = errors.New("Invalid Credentials") - NO_CONFIG = errors.New("No config found, please create with `pf9ctl config set`") + NO_CONFIG = errors.New(fmt.Sprintf("No config found, please create with `%s config set`", util.Ctl)) MISSSING_FIELDS = errors.New("Missing mandatory field(s) (Platform9 Account URL/Username/Password/Region/Tenant)") MAX_ATTEMPTS_ERROR = errors.New("Invalid credentials entered multiple times (Platform9 Account URL/Username/Password/Region/Tenant/Proxy URL/MFA Token)") ) @@ -369,7 +369,7 @@ func createClient(cfg *objects.Config, nc objects.NodeConfig) (client.Client, er return client.NewClient(cfg.Fqdn, executor, cfg.AllowInsecure, false) } -//This function clears the context if it is invalid. Before storing it. +// This function clears the context if it is invalid. Before storing it. func clearContext(v interface{}) { p := reflect.ValueOf(v).Elem() p.Set(reflect.Zero(p.Type())) diff --git a/pkg/util/constants.go b/pkg/util/constants.go index cd9e918..f335fd6 100644 --- a/pkg/util/constants.go +++ b/pkg/util/constants.go @@ -1,6 +1,7 @@ package util import ( + "fmt" "os" "path/filepath" "regexp" @@ -62,13 +63,15 @@ const ( PmkVersion = "1.20.11" Docker = "docker" Calico = "calico" + + Ctl = "pf9ctl" ) var ( // Constants for check failure messages - PyCliErr = "Earlier version of pf9ctl already exists. This must be uninstalled." + PyCliErr = fmt.Sprintf("Earlier version of %s already exists. This must be uninstalled.", Ctl) ExisitngInstallationErr = "Platform9 packages already exist. These must be uninstalled." - SudoErr = "User running pf9ctl must have privilege (sudo) mode enabled." + SudoErr = fmt.Sprintf("User running %s must have privilege (sudo) mode enabled.", Ctl) OSPackagesErr = "Some OS packages needed for the CLI not found" CPUErr = "At least 2 CPUs are needed on host." DiskErr = "At least 30 GB of total disk space and 15 GB of free space is needed on host."