Skip to content

Commit

Permalink
reflect comment
Browse files Browse the repository at this point in the history
Signed-off-by: Masayuki Ishii <masa213f@gmail.com>
  • Loading branch information
masa213f committed Sep 6, 2024
1 parent 304dd2e commit c45c9fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
11 changes: 4 additions & 7 deletions cmd/kubectl-moco/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cmd
import (
"context"
"fmt"
"os"

mocov1beta2 "github.com/cybozu-go/moco/api/v1beta2"
"github.com/cybozu-go/moco/pkg/constants"
Expand Down Expand Up @@ -50,16 +49,15 @@ func startClustering(ctx context.Context, name string) error {
}

if equality.Semantic.DeepEqual(orig, cluster) {
fmt.Fprintf(os.Stdout, "The clustering is already running.\n")
fmt.Println("The clustering is already running.")
return nil
}

if err := kubeClient.Update(ctx, cluster); err != nil {
return fmt.Errorf("failed to start clustering of MySQLCluster: %w", err)
}

fmt.Fprintf(os.Stdout, "started clustering of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name))

fmt.Printf("started clustering of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name))
return nil
}

Expand Down Expand Up @@ -89,15 +87,14 @@ func startReconciliation(ctx context.Context, name string) error {
}

if equality.Semantic.DeepEqual(orig, cluster) {
fmt.Fprintf(os.Stdout, "The reconciliation is already running.\n")
fmt.Println("The reconciliation is already running.")
return nil
}

if err := kubeClient.Update(ctx, cluster); err != nil {
return fmt.Errorf("failed to start reconciliation of MySQLCluster: %w", err)
}

fmt.Fprintf(os.Stdout, "started reconciliation of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name))

fmt.Printf("started reconciliation of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name))
return nil
}
11 changes: 4 additions & 7 deletions cmd/kubectl-moco/cmd/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cmd
import (
"context"
"fmt"
"os"

mocov1beta2 "github.com/cybozu-go/moco/api/v1beta2"
"github.com/cybozu-go/moco/pkg/constants"
Expand Down Expand Up @@ -51,16 +50,15 @@ func stopClustering(ctx context.Context, name string) error {
cluster.Annotations[constants.AnnClusteringStopped] = "true"

if equality.Semantic.DeepEqual(orig, cluster) {
fmt.Fprintf(os.Stdout, "The clustering is already stopped.\n")
fmt.Println("The clustering is already stopped.")
return nil
}

if err := kubeClient.Update(ctx, cluster); err != nil {
return fmt.Errorf("failed to stop clustering of MySQLCluster: %w", err)
}

fmt.Fprintf(os.Stdout, "stopped clustering of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name))

fmt.Printf("stopped clustering of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name))
return nil
}

Expand Down Expand Up @@ -91,15 +89,14 @@ func stopReconciliation(ctx context.Context, name string) error {
cluster.Annotations[constants.AnnReconciliationStopped] = "true"

if equality.Semantic.DeepEqual(orig, cluster) {
fmt.Fprintf(os.Stdout, "The reconciliation is already stopped.\n")
fmt.Println("The reconciliation is already stopped.")
return nil
}

if err := kubeClient.Update(ctx, cluster); err != nil {
return fmt.Errorf("failed to stop reconciliation of MySQLCluster: %w", err)
}

fmt.Fprintf(os.Stdout, "stopped reconciliation of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name))

fmt.Printf("stopped reconciliation of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name))
return nil
}

0 comments on commit c45c9fd

Please sign in to comment.