From 0667c64db23b44d3317aed8e4104cc42f01b4d97 Mon Sep 17 00:00:00 2001 From: xuyongliang_01 Date: Tue, 3 Sep 2024 05:35:24 +0000 Subject: [PATCH] update cmd/deploy.go. Signed-off-by: xuyongliang_01 --- cmd/deploy.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/cmd/deploy.go b/cmd/deploy.go index 618941c..1d42099 100755 --- a/cmd/deploy.go +++ b/cmd/deploy.go @@ -94,14 +94,14 @@ func validateDeployConfig() error { clusterConfigFile := filepath.Join(opts.Opts.RootOptDir, opts.Opts.ClusterID, clusterConfigFile) // Check if clusterConfigFile already exists if _, err := os.Stat(clusterConfigFile); err == nil { - logrus.Debugf("cluster ID: %s already exists", opts.Opts.ClusterID) - return fmt.Errorf("cluster ID: %s already exists", opts.Opts.ClusterID) + logrus.Debugf("Cluster ID: %s already exists", opts.Opts.ClusterID) + return fmt.Errorf("Cluster ID: %s already exists", opts.Opts.ClusterID) } // Check if kubectl is installed if !kubeclient.IsKubectlInstalled() { - logrus.Debug("kubectl is not installed") - return fmt.Errorf("kubectl is not installed") + logrus.Debug("Kubectl is not installed") + return fmt.Errorf("Kubectl is not installed") } return nil } @@ -147,7 +147,7 @@ func createCluster(conf *asset.ClusterAsset) error { if strings.ToLower(conf.Platform) == "pxe" || strings.ToLower(conf.Platform) == "ipxe" { if err := addKickstartFiles(httpService, conf); err != nil { - return fmt.Errorf("error adding kickstart file to cache: %v", err) + return fmt.Errorf("Error adding kickstart file to cache: %v", err) } } } @@ -222,14 +222,14 @@ func createCluster(conf *asset.ClusterAsset) error { go func() { select { case <-httpService.Ch: - logrus.Info("tftp server stop") + logrus.Info("Tftp server stop") tftpService.Stop() return } }() go func() { if err := tftpService.Start(); err != nil { - logrus.Errorf("error starting http service: %v", err) + logrus.Errorf("Error starting http service: %v", err) return } }() @@ -244,12 +244,12 @@ func createCluster(conf *asset.ClusterAsset) error { return err } if err := httpService.AddFileToCache(constants.IPXECfg, fileContent); err != nil { - return fmt.Errorf("error adding ipxe config file to cache: %v", err) + return fmt.Errorf("Error adding ipxe config file to cache: %v", err) } httpserver.StartHTTPService(httpService) default: - return errors.New("unsupported platform") + return errors.New("Unsupported platform") } if err := clusterCreatePost(conf); err != nil { @@ -464,18 +464,18 @@ func addIgnitionFiles(httpService *httpserver.HTTPService, conf *asset.ClusterAs // Only one master node if err := httpService.AddFileToCache(constants.ControlplaneIgn, conf.BootConfig.Controlplane.Content); err != nil { - return fmt.Errorf("error adding control plane ignition file to cache: %v", err) + return fmt.Errorf("Error adding control plane ignition file to cache: %v", err) } // multiple master nodes if len(conf.Master) > 1 { if err := httpService.AddFileToCache(constants.MasterIgn, conf.BootConfig.Master.Content); err != nil { - return fmt.Errorf("error adding master ignition file to cache: %v", err) + return fmt.Errorf("Error adding master ignition file to cache: %v", err) } } if err := httpService.AddFileToCache(constants.WorkerIgn, conf.BootConfig.Worker.Content); err != nil { - return fmt.Errorf("error adding worker ignition file to cache: %v", err) + return fmt.Errorf("Error adding worker ignition file to cache: %v", err) } return nil @@ -484,7 +484,7 @@ func addIgnitionFiles(httpService *httpserver.HTTPService, conf *asset.ClusterAs func addKickstartFiles(httpService *httpserver.HTTPService, conf *asset.ClusterAsset) error { // Only one master node if err := httpService.AddFileToCache(conf.Master[0].Hostname+constants.KickstartSuffix, conf.BootConfig.Controlplane.Content); err != nil { - return fmt.Errorf("error adding control plane kickstart file to cache: %v", err) + return fmt.Errorf("Error adding control plane kickstart file to cache: %v", err) } // multiple master nodes @@ -492,13 +492,13 @@ func addKickstartFiles(httpService *httpserver.HTTPService, conf *asset.ClusterA if n > 1 { for i := 1; i < n; i++ { if err := httpService.AddFileToCache(conf.Master[i].Hostname+constants.KickstartSuffix, conf.BootConfig.KickstartMaster[i-1].Content); err != nil { - return fmt.Errorf("error adding master kickstart file to cache: %v", err) + return fmt.Errorf("Error adding master kickstart file to cache: %v", err) } } } if err := httpService.AddFileToCache(constants.Worker+constants.KickstartSuffix, conf.BootConfig.Worker.Content); err != nil { - return fmt.Errorf("error adding worker kickstart file to cache: %v", err) + return fmt.Errorf("Error adding worker kickstart file to cache: %v", err) } return nil -- Gitee