From 6d3477437935e6a8a7668b2b7ca768b9fecd21b5 Mon Sep 17 00:00:00 2001 From: Ahmet Oeztuerk Date: Thu, 28 May 2026 18:08:24 +0200 Subject: [PATCH] check_drivesize: accept drive argument if drive+seperator string equals the argument example drive=/boot and drive=/boot/ to arguments both work now, previously it was only /boot --- pkg/snclient/check_drivesize_other.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/snclient/check_drivesize_other.go b/pkg/snclient/check_drivesize_other.go index 24395007..01114869 100644 --- a/pkg/snclient/check_drivesize_other.go +++ b/pkg/snclient/check_drivesize_other.go @@ -6,6 +6,7 @@ import ( "context" "fmt" "os" + "path/filepath" "strings" "github.com/consol-monitoring/snclient/pkg/utils" @@ -116,6 +117,13 @@ func (l *CheckDrivesize) setCustomPath(path string, requiredDisks map[string]map if path == vol["drive"] { match = &vol + break + } + if path == fmt.Sprintf("%s%c", vol["drive"], filepath.Separator) { + match = &vol + + log.Debugf("Taking drive: '%s' for path: '%s' since it just needs a separator: '%c' at the end", vol["drive"], path, filepath.Separator) + break } } @@ -130,7 +138,7 @@ func (l *CheckDrivesize) setCustomPath(path string, requiredDisks map[string]map // add anyway to generate an error later with more default values filled in entry := l.driveEntry(path) entry["_error"] = (&PartitionNotMountedError{ - Path: path, err: fmt.Errorf("path :%s does exist, but could not match it to a drive. its likely that the partition is not mounted", path), + Path: path, err: fmt.Errorf("path :%s does exist, but could not match it to a drive. its likely that the partition does not exist or is not mounted", path), }).Error() requiredDisks[path] = entry