Skip to content

Commit

Permalink
csi: correct conditional logic for fuse mount options argument
Browse files Browse the repository at this point in the history
Previously, the function incorrectly checked if `len(options) == 0`,
causing it to return a non-empty argument when no options were provided.
This fix updates the condition to `len(options) > 0`, ensuring the argument
is only set when options exist.

Signed-off-by: Praveen M <m.praveen@ibm.com>
  • Loading branch information
iPraveenParihar committed Feb 25, 2025
1 parent 31a93b4 commit 39e27e4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/utils/csi.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,14 @@ func LogRotateConfigMapName(driverName string) string {
func KernelMountOptionsContainerArg(options map[string]string) string {
return If(
len(options) > 0,
fmt.Sprintf("--kernelmountoptions==%s", MapToString(options, "=", ",")),
fmt.Sprintf("--kernelmountoptions=%s", MapToString(options, "=", ",")),
"",
)
}
func FuseMountOptionsContainerArg(options map[string]string) string {
return If(
len(options) == 0,
fmt.Sprintf("--fusemountoptions==%s", MapToString(options, "=", ",")),
len(options) > 0,
fmt.Sprintf("--fusemountoptions=%s", MapToString(options, "=", ",")),
"",
)
}
Expand Down

0 comments on commit 39e27e4

Please sign in to comment.