Skip to content

Commit d56bab4

Browse files
committed
lint fixes
1 parent 385220d commit d56bab4

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

cmd/node-joiner/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
)
1111

1212
func main() {
13-
1413
wd, err := os.Getwd()
1514
if err != nil {
1615
logrus.Fatal(err)

pkg/asset/agent/joiner/addnodesconfig.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,33 @@ import (
77
"path/filepath"
88

99
"github.com/openshift/installer/pkg/asset"
10-
"github.com/pkg/errors"
1110
)
1211

1312
const (
1413
addNodesParamsFile = ".addnodesparams"
1514
)
1615

16+
// AddNodesConfig is used to store the current configuration
17+
// for the command.
1718
type AddNodesConfig struct {
1819
File *asset.File
1920
Params Params
2021
}
2122

22-
// Params is used to store the command line parameters
23+
// Params is used to store the command line parameters.
2324
type Params struct {
2425
Kubeconfig string `json:"kubeconfig,omitempty"`
2526
}
2627

27-
// Save stores the current parameters on disk
28+
// Save stores the current parameters on disk.
2829
func (p *Params) Save(assetsDir string) error {
2930
data, err := json.Marshal(p)
3031
if err != nil {
3132
return err
3233
}
3334

3435
fileName := filepath.Join(assetsDir, addNodesParamsFile)
35-
return os.WriteFile(fileName, data, 0o644)
36+
return os.WriteFile(fileName, data, 0o600)
3637
}
3738

3839
// Name returns the human-friendly name of the asset.

pkg/asset/agent/joiner/clusterinfo.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import (
44
"context"
55
"net/url"
66

7-
configclient "github.com/openshift/client-go/config/clientset/versioned"
87
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/client-go/kubernetes"
109
"k8s.io/client-go/rest"
1110
"k8s.io/client-go/tools/clientcmd"
1211

12+
configclient "github.com/openshift/client-go/config/clientset/versioned"
1313
"github.com/openshift/installer/pkg/asset"
1414
"github.com/openshift/installer/pkg/asset/agent/workflow"
1515
)
@@ -18,7 +18,7 @@ import (
1818
// from an already existing cluster.
1919
type ClusterInfo struct {
2020
ClusterID string
21-
ApiDnsName string
21+
APIDNSName string
2222
PullSecret string
2323
}
2424

@@ -58,7 +58,7 @@ func (ci *ClusterInfo) Generate(dependencies asset.Parents) error {
5858
return err
5959
}
6060

61-
err = ci.retrieveApiDnsName(config)
61+
err = ci.retrieveAPIDNSName(config)
6262
if err != nil {
6363
return err
6464
}
@@ -99,14 +99,13 @@ func (ci *ClusterInfo) retrieveClusterID(config *rest.Config) error {
9999
return nil
100100
}
101101

102-
func (ci *ClusterInfo) retrieveApiDnsName(config *rest.Config) error {
103-
104-
parsedUrl, err := url.Parse(config.Host)
102+
func (ci *ClusterInfo) retrieveAPIDNSName(config *rest.Config) error {
103+
parsedURL, err := url.Parse(config.Host)
105104
if err != nil {
106105
return err
107106
}
108107

109-
ci.ApiDnsName = parsedUrl.Hostname()
108+
ci.APIDNSName = parsedURL.Hostname()
110109
return nil
111110
}
112111

pkg/asset/agent/workflow/agentworkflow.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ import (
55
"os"
66

77
"github.com/openshift/installer/pkg/asset"
8-
"github.com/pkg/errors"
98
)
109

1110
// AgentWorkflow allows other assets to check
12-
// which is the workflow currently active
11+
// which is the workflow currently active.
1312
type AgentWorkflow struct {
1413
File *asset.File
1514
Workflow AgentWorkflowType
@@ -30,7 +29,6 @@ func (*AgentWorkflow) Dependencies() []asset.Asset {
3029

3130
// Generate generates the AgentWorkflow asset.
3231
func (a *AgentWorkflow) Generate(dependencies asset.Parents) error {
33-
3432
// Set install workflow as a default
3533
a.Workflow = AgentWorkflowTypeInstall
3634
a.File = &asset.File{
@@ -56,7 +54,7 @@ func (a *AgentWorkflow) Load(f asset.FileFetcher) (bool, error) {
5654
if os.IsNotExist(err) {
5755
return false, nil
5856
}
59-
return false, errors.Wrap(err, fmt.Sprintf("failed to load %s file", agentWorkflowFilename))
57+
return false, fmt.Errorf("failed to load %s file: %w", agentWorkflowFilename, err)
6058
}
6159

6260
// Get the current workflow

pkg/asset/agent/workflow/agentworkflowaddnodes.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package workflow
33
import "github.com/openshift/installer/pkg/asset"
44

55
// AgentWorkflowAddNodes is meant just to define
6-
// the add nodes workflow
6+
// the add nodes workflow.
77
type AgentWorkflowAddNodes struct {
88
AgentWorkflow
99
}
@@ -17,7 +17,6 @@ func (*AgentWorkflowAddNodes) Name() string {
1717

1818
// Generate generates the AgentWorkflow asset.
1919
func (a *AgentWorkflowAddNodes) Generate(dependencies asset.Parents) error {
20-
2120
a.Workflow = AgentWorkflowTypeAddNodes
2221
a.File = &asset.File{
2322
Filename: agentWorkflowFilename,

pkg/asset/agent/workflow/commons.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ package workflow
55
type AgentWorkflowType string
66

77
const (
8-
AgentWorkflowTypeInstall AgentWorkflowType = "install"
8+
// AgentWorkflowTypeInstall identifies the install workflow.
9+
AgentWorkflowTypeInstall AgentWorkflowType = "install"
10+
// AgentWorkflowTypeAddNodes identifies the add nodes workflow.
911
AgentWorkflowTypeAddNodes AgentWorkflowType = "addnodes"
1012

1113
agentWorkflowFilename = ".agentworkflow"

pkg/nodejoiner/addnodes.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ import (
99

1010
// NewAddNodesCommand creates a new command for add nodes.
1111
func NewAddNodesCommand(directory string, kubeConfig string) error {
12-
1312
// Store the current parameters into the assets folder, so
1413
// that they could be retrieved later by the assets
1514
params := joiner.Params{
1615
Kubeconfig: kubeConfig,
1716
}
18-
params.Save(directory)
17+
err := params.Save(directory)
18+
if err != nil {
19+
return err
20+
}
1921

2022
fetcher := store.NewAssetsFetcher(directory)
2123
return fetcher.FetchAndPersist([]asset.WritableAsset{

0 commit comments

Comments
 (0)