Skip to content

Commit

Permalink
fix: import (#419)
Browse files Browse the repository at this point in the history
* fix: import

* Update internal/secrets/import.go

Co-authored-by: Patrick D'appollonio <[email protected]>

* fix: return

---------

Co-authored-by: Patrick D'appollonio <[email protected]>
  • Loading branch information
CristhianF7 and patrickdappollonio authored Aug 31, 2024
1 parent 28af1d7 commit 41a549c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/secrets/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ func ImportClusterIfEmpty(silent bool) (pkgtypes.Cluster, error) {
log.Info().Msgf("import cluster secret discovered for cluster %s", cluster.ClusterName)

// if you find a record bail
_, err = GetCluster(kcfg.Clientset, cluster.ClusterName)
existingCluster, err := GetCluster(kcfg.Clientset, cluster.ClusterName)
if err != nil {
log.Info().Stack().Msgf("did not find preexisting record for cluster %s. importing record.", cluster.ClusterName)
return existingCluster, fmt.Errorf("unable to find cluster: %w", err)
}

if existingCluster.ClusterID == "" {
log.Info().Stack().Msgf("did not find preexisting record for cluster %s. importing record.", cluster.ClusterName)
// Create if entry does not exist
err = InsertCluster(kcfg.Clientset, cluster)
if err != nil {
Expand Down

0 comments on commit 41a549c

Please sign in to comment.