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

Add a line break to kubectl-moco start/stop command's message #737

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.")
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.")
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.")
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.")
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
}
Loading