mirror of
https://github.com/fluxcd/flux2.git
synced 2025-11-03 03:12:00 +08:00
Inform user of path being used
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
This commit is contained in:
@ -267,7 +267,7 @@ func generateDeployKey(ctx context.Context, kubeClient client.Client, url *url.U
|
|||||||
return string(pair.PublicKey), nil
|
return string(pair.PublicKey), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkIfBootstrapPathDiffers(ctx context.Context, kubeClient client.Client, namespace string, path string) bool {
|
func checkIfBootstrapPathDiffers(ctx context.Context, kubeClient client.Client, namespace string, path string) (string, bool) {
|
||||||
namespacedName := types.NamespacedName{
|
namespacedName := types.NamespacedName{
|
||||||
Name: namespace,
|
Name: namespace,
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
@ -275,11 +275,11 @@ func checkIfBootstrapPathDiffers(ctx context.Context, kubeClient client.Client,
|
|||||||
var fluxSystemKustomization kustomizev1.Kustomization
|
var fluxSystemKustomization kustomizev1.Kustomization
|
||||||
err := kubeClient.Get(ctx, namespacedName, &fluxSystemKustomization)
|
err := kubeClient.Get(ctx, namespacedName, &fluxSystemKustomization)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return "", false
|
||||||
}
|
}
|
||||||
if fluxSystemKustomization.Spec.Path == path {
|
if fluxSystemKustomization.Spec.Path == path {
|
||||||
return false
|
return "", false
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return fluxSystemKustomization.Spec.Path, true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -123,10 +123,10 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstrapPathDiffers := checkIfBootstrapPathDiffers(ctx, kubeClient, namespace, filepath.ToSlash(ghPath.String()))
|
usedPath, bootstrapPathDiffers := checkIfBootstrapPathDiffers(ctx, kubeClient, namespace, filepath.ToSlash(ghPath.String()))
|
||||||
|
|
||||||
if bootstrapPathDiffers {
|
if bootstrapPathDiffers {
|
||||||
return fmt.Errorf("cluster already bootstrapped to a different path")
|
return fmt.Errorf("cluster already bootstrapped to a %v path", usedPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
repository, err := git.NewRepository(ghRepository, ghOwner, ghHostname, ghToken, "flux", ghOwner+"@users.noreply.github.com")
|
repository, err := git.NewRepository(ghRepository, ghOwner, ghHostname, ghToken, "flux", ghOwner+"@users.noreply.github.com")
|
||||||
|
|||||||
@ -123,10 +123,10 @@ func bootstrapGitLabCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstrapPathDiffers := checkIfBootstrapPathDiffers(ctx, kubeClient, namespace, filepath.ToSlash(glPath.String()))
|
usedPath, bootstrapPathDiffers := checkIfBootstrapPathDiffers(ctx, kubeClient, namespace, filepath.ToSlash(glPath.String()))
|
||||||
|
|
||||||
if bootstrapPathDiffers {
|
if bootstrapPathDiffers {
|
||||||
return fmt.Errorf("cluster already bootstrapped to a different path")
|
return fmt.Errorf("cluster already bootstrapped to a %v path", usedPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
repository, err := git.NewRepository(glRepository, glOwner, glHostname, glToken, "flux", glOwner+"@users.noreply.gitlab.com")
|
repository, err := git.NewRepository(glRepository, glOwner, glHostname, glToken, "flux", glOwner+"@users.noreply.gitlab.com")
|
||||||
|
|||||||
Reference in New Issue
Block a user