mirror of https://github.com/rancher/dartboard.git
fix lint errors
Signed-off-by: Silvio Moioli <silvio@moioli.net>
This commit is contained in:
parent
84e954ded5
commit
a4da74986e
|
|
@ -116,7 +116,7 @@ func Deploy(cli *cli.Context) error {
|
|||
}
|
||||
|
||||
func chartInstall(kubeConf string, chart chart, jsonVals string) error {
|
||||
var vals map[string]interface{} = nil
|
||||
var vals map[string]interface{}
|
||||
var err error
|
||||
|
||||
name := chart.name
|
||||
|
|
@ -516,7 +516,7 @@ func importDownstreamClusterDo(r *dart.Dart, rancherImageTag string, tf *tofu.To
|
|||
defer os.Remove(yamlFile.Name())
|
||||
defer yamlFile.Close()
|
||||
|
||||
clusterId, err := importClustersDownstreamGetYAML(clusters, clusterName, yamlFile)
|
||||
clusterID, err := importClustersDownstreamGetYAML(clusters, clusterName, yamlFile)
|
||||
if err != nil {
|
||||
errCh <- fmt.Errorf("%s import failed: %w", clusterName, err)
|
||||
return
|
||||
|
|
@ -542,7 +542,7 @@ func importDownstreamClusterDo(r *dart.Dart, rancherImageTag string, tf *tofu.To
|
|||
}
|
||||
|
||||
if err := kubectl.WaitForReadyCondition(clusters["upstream"].Kubeconfig,
|
||||
"clusters.management.cattle.io", clusterId, "", 10); err != nil {
|
||||
"clusters.management.cattle.io", clusterID, "", 10); err != nil {
|
||||
errCh <- fmt.Errorf("%s import failed: %w", clusterName, err)
|
||||
return
|
||||
}
|
||||
|
|
@ -594,7 +594,7 @@ func importDownstreamClustersRancherSetup(r *dart.Dart, clusters map[string]tofu
|
|||
return nil
|
||||
}
|
||||
|
||||
func importClustersDownstreamGetYAML(clusters map[string]tofu.Cluster, name string, yamlFile *os.File) (clusterId string, err error) {
|
||||
func importClustersDownstreamGetYAML(clusters map[string]tofu.Cluster, name string, yamlFile *os.File) (clusterID string, err error) {
|
||||
var status map[string]interface{}
|
||||
|
||||
upstream := clusters["upstream"]
|
||||
|
|
@ -612,14 +612,14 @@ func importClustersDownstreamGetYAML(clusters map[string]tofu.Cluster, name stri
|
|||
if status, err = cliUpstream.GetStatus("provisioning.cattle.io", "v1", resource, name, namespace); err != nil {
|
||||
return
|
||||
}
|
||||
clusterId, ok := status["clusterName"].(string)
|
||||
clusterID, ok := status["clusterName"].(string)
|
||||
if !ok {
|
||||
err = fmt.Errorf("error accessing %s/%s %s: no valid 'clusterName' in 'Status'", namespace, name, resource)
|
||||
return
|
||||
}
|
||||
|
||||
name = "default-token"
|
||||
namespace = clusterId
|
||||
namespace = clusterID
|
||||
resource = "clusterregistrationtokens"
|
||||
if status, err = cliUpstream.GetStatus("management.cattle.io", "v3", resource, name, namespace); err != nil {
|
||||
return
|
||||
|
|
@ -630,7 +630,7 @@ func importClustersDownstreamGetYAML(clusters map[string]tofu.Cluster, name stri
|
|||
return
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("%s/v3/import/%s_%s.yaml", upstreamAdd.Local.HTTPSURL, token, clusterId)
|
||||
url := fmt.Sprintf("%s/v3/import/%s_%s.yaml", upstreamAdd.Local.HTTPSURL, token, clusterID)
|
||||
tr := &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}
|
||||
client := &http.Client{Transport: tr}
|
||||
resp, err := client.Get(url)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ type Image struct {
|
|||
|
||||
// Images returns known docker images matching the image reference
|
||||
func Images(image string) ([]string, error) {
|
||||
args := append([]string{"images", "--filter=reference=" + image, "--format=json"})
|
||||
args := []string{"images", "--filter=reference=" + image, "--format=json"}
|
||||
log.Printf("Exec: docker %s\n", strings.Join(args, " "))
|
||||
|
||||
cmd := exec.Command("docker", args...)
|
||||
|
|
@ -41,7 +41,7 @@ func Images(image string) ([]string, error) {
|
|||
cmd.Stdout = &outStream
|
||||
cmd.Stderr = &errStream
|
||||
if err := cmd.Run(); err != nil {
|
||||
return nil, fmt.Errorf(errStream.String())
|
||||
return nil, fmt.Errorf("%v", errStream.String())
|
||||
}
|
||||
|
||||
lines := strings.Split(strings.TrimSpace(outStream.String()), "\n")
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ func printNotes(r *release.Release, err error) error {
|
|||
return err
|
||||
}
|
||||
if r.Info.Notes != "" {
|
||||
log.Printf(r.Info.Notes)
|
||||
log.Println(r.Info.Notes)
|
||||
} else {
|
||||
log.Printf("No notes for release %s", r.Name)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import (
|
|||
)
|
||||
|
||||
func ImageImport(cluster tofu.Cluster, image string) error {
|
||||
args := append([]string{"image", "import", "--cluster", strings.Replace(cluster.Context, "k3d-", "", -1), image})
|
||||
args := []string{"image", "import", "--cluster", strings.Replace(cluster.Context, "k3d-", "", -1), image}
|
||||
log.Printf("Exec: docker %s\n", strings.Join(args, " "))
|
||||
|
||||
cmd := exec.Command("k3d", args...)
|
||||
|
|
@ -35,7 +35,7 @@ func ImageImport(cluster tofu.Cluster, image string) error {
|
|||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = &errStream
|
||||
if err := cmd.Run(); err != nil {
|
||||
return fmt.Errorf(errStream.String())
|
||||
return fmt.Errorf("%v", errStream.String())
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ func Exec(kubepath string, output io.Writer, args ...string) error {
|
|||
cmd.Stderr = &errStream
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
return fmt.Errorf(errStream.String())
|
||||
return fmt.Errorf("%v", errStream.String())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,17 +114,17 @@ func (t *Tofu) Destroy(ctx context.Context) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (t *Tofu) OutputClustersJson(ctx context.Context) (string, error) {
|
||||
func (t *Tofu) OutputClustersJSON(ctx context.Context) (string, error) {
|
||||
tfOutput, err := t.tf.Output(ctx)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("error: tofu OutputClustersJson: %w", err)
|
||||
return "", fmt.Errorf("error: tofu OutputClustersJSON: %w", err)
|
||||
}
|
||||
|
||||
if clusters, ok := tfOutput["clusters"]; ok {
|
||||
return string(clusters.Value), nil
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("error: tofu OutputClustersJson: no cluster data")
|
||||
return "", fmt.Errorf("error: tofu OutputClustersJSON: no cluster data")
|
||||
}
|
||||
|
||||
func (t *Tofu) OutputClusters(ctx context.Context) (map[string]Cluster, error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue