Skip to content

Commit 57e801e

Browse files
authored
Merge pull request #167 from IBM/rclone-typo
Fix linter issues
2 parents cd01e34 + 4980dd1 commit 57e801e

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

cos-csi-mounter/server/rclone.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ func (args RCloneArgs) Validate(targetPath string) error {
9595

9696
// Check if rclone config file exists or not
9797
if exists, err := fileExists(args.ConfigPath); err != nil {
98-
logger.Error("error checking file existence", zap.Error(err), zap.Any("path", args.ConfigPath))
99-
return fmt.Errorf("error checking file existence: %v", err)
98+
logger.Error("error checking rclone config file existence", zap.Error(err))
99+
return fmt.Errorf("error checking rclone config file existence: %v", err)
100100
} else if !exists {
101-
logger.Error("file not found", zap.Error(err), zap.Any("path", args.ConfigPath))
102-
return fmt.Errorf("file not found: %v", args.ConfigPath)
101+
logger.Error("rclone config file not found")
102+
return fmt.Errorf("rclone config file not found")
103103
}
104104

105105
// Check if value of daemon parameter is boolean "true" or "false"

cos-csi-mounter/server/s3fs.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,6 @@ func (args S3FSArgs) Validate(targetPath string) error {
106106
return fmt.Errorf("invalid value for 'curldbg' param. Should be either 'body' or 'normal': %v", args.CurlDebug)
107107
}
108108

109-
if !(strings.HasPrefix(args.EndPoint, "https://") || strings.HasPrefix(args.EndPoint, "http://")) {
110-
logger.Error("bad value for endpoint: scheme is missing."+
111-
" Must be of the form http://<hostname> or https://<hostname>",
112-
zap.String("endpoint", args.EndPoint))
113-
return fmt.Errorf("bad value for endpoint \"%v\": scheme is missing."+
114-
" Must be of the form http://<hostname> or https://<hostname>", args.EndPoint)
115-
}
116-
117109
// Check if value of gid parameter can be converted to integer
118110
if args.GID != "" {
119111
_, err := strconv.Atoi(args.GID)
@@ -205,11 +197,11 @@ func (args S3FSArgs) Validate(targetPath string) error {
205197

206198
// Check if .passwd file exists or not
207199
if exists, err := fileExists(args.PasswdFilePath); err != nil {
208-
logger.Error("error checking file existence", zap.Error(err), zap.Any("path", args.PasswdFilePath))
209-
return fmt.Errorf("error checking file existence: %v", err)
200+
logger.Error("error checking credential file existence", zap.Error(err))
201+
return fmt.Errorf("error checking credential file existence: %v", err)
210202
} else if !exists {
211-
logger.Error("file not found", zap.Error(err), zap.Any("path", args.PasswdFilePath))
212-
return fmt.Errorf("file not found: %v", args.PasswdFilePath)
203+
logger.Error("credential file not found")
204+
return fmt.Errorf("credential file not found")
213205
}
214206

215207
// Check if value of ro parameter is boolean "true" or "false"
@@ -295,5 +287,13 @@ func (args S3FSArgs) Validate(targetPath string) error {
295287
}
296288
}
297289

290+
if !(strings.HasPrefix(args.URL, "https://") || strings.HasPrefix(args.URL, "http://")) {
291+
logger.Error("bad value for url: scheme is missing."+
292+
" Must be of the form http://<hostname> or https://<hostname>",
293+
zap.String("url", args.URL))
294+
return fmt.Errorf("bad value for url \"%v\": scheme is missing."+
295+
" Must be of the form http://<hostname> or https://<hostname>", args.URL)
296+
}
297+
298298
return nil
299299
}

cos-csi-mounter/server/server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func handleCosUnmount() gin.HandlerFunc {
158158
return
159159
}
160160

161-
logger.Info("bucket unmount is Successful", zap.Any("path", request.Path))
161+
logger.Info("bucket unmount is successful", zap.Any("path", request.Path))
162162
c.JSON(http.StatusOK, "Success!!")
163163
}
164164
}

0 commit comments

Comments
 (0)