From c9070ffa8c37f100c9af1c152c326fc00ef3dae5 Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Tue, 10 Oct 2017 04:50:52 +0000 Subject: [PATCH] remove getAvailableDriveLetter func and test --- pkg/util/mount/mount_windows.go | 14 -------------- pkg/util/mount/mount_windows_test.go | 6 ------ 2 files changed, 20 deletions(-) diff --git a/pkg/util/mount/mount_windows.go b/pkg/util/mount/mount_windows.go index 6376abcdc4..69c831cbc3 100644 --- a/pkg/util/mount/mount_windows.go +++ b/pkg/util/mount/mount_windows.go @@ -256,20 +256,6 @@ func normalizeWindowsPath(path string) string { return normalizedPath } -func getAvailableDriveLetter() (string, error) { - cmd := "$used = Get-PSDrive | Select-Object -Expand Name | Where-Object { $_.Length -eq 1 }" - cmd += ";$drive = 67..90 | ForEach-Object { [string][char]$_ } | Where-Object { $used -notcontains $_ } | Select-Object -First 1;$drive" - output, err := exec.Command("powershell", "/c", cmd).CombinedOutput() - if err != nil { - return "", fmt.Errorf("getAvailableDriveLetter failed: %v, output: %q", err, string(output)) - } - - if len(output) == 0 { - return "", fmt.Errorf("azureMount: there is no available drive letter now") - } - return string(output)[:1], nil -} - // ValidateDiskNumber : disk number should be a number in [0, 99] func ValidateDiskNumber(disk string) error { diskNum, err := strconv.Atoi(disk) diff --git a/pkg/util/mount/mount_windows_test.go b/pkg/util/mount/mount_windows_test.go index 6be0fc43e1..1817c8e4e2 100644 --- a/pkg/util/mount/mount_windows_test.go +++ b/pkg/util/mount/mount_windows_test.go @@ -22,12 +22,6 @@ import ( "testing" ) -func TestGetAvailableDriveLetter(t *testing.T) { - if _, err := getAvailableDriveLetter(); err != nil { - t.Errorf("getAvailableDriveLetter test failed : %v", err) - } -} - func TestNormalizeWindowsPath(t *testing.T) { path := `/var/lib/kubelet/pods/146f8428-83e7-11e7-8dd4-000d3a31dac4/volumes/kubernetes.io~azure-disk` normalizedPath := normalizeWindowsPath(path)