From bb69afc5f2e9a88d3e76a453ef39295090b788b9 Mon Sep 17 00:00:00 2001 From: Anjan Nath Date: Tue, 9 May 2023 14:37:07 +0530 Subject: [PATCH] preflight: add check to see if admin-helper namedpipe is accessible currently we only check if the admin-helper service is running, but it could happen that the service is running but current user is not in the 'crc-users' group, in this case directly trying to access the admin-helper api is better --- pkg/crc/preflight/preflight_checks_windows.go | 9 +++++++++ pkg/crc/preflight/preflight_windows.go | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/crc/preflight/preflight_checks_windows.go b/pkg/crc/preflight/preflight_checks_windows.go index 9b3bb2db48..a40413a36c 100644 --- a/pkg/crc/preflight/preflight_checks_windows.go +++ b/pkg/crc/preflight/preflight_checks_windows.go @@ -7,6 +7,7 @@ import ( "github.com/crc-org/crc/pkg/crc/logging" + "github.com/crc-org/crc/pkg/crc/adminhelper" winnet "github.com/crc-org/crc/pkg/os/windows/network" "github.com/crc-org/crc/pkg/os/windows/powershell" @@ -224,5 +225,13 @@ func checkIfAdminHelperServiceRunning() error { if strings.TrimSpace(stdout) != "Running" { return fmt.Errorf("%s service is not running", constants.AdminHelperServiceName) } + return checkAdminHelperNamedPipeAccessible() +} + +func checkAdminHelperNamedPipeAccessible() error { + client := adminhelper.Client() + if _, err := client.Version(); err != nil { + return err + } return nil } diff --git a/pkg/crc/preflight/preflight_windows.go b/pkg/crc/preflight/preflight_windows.go index 006575f7e5..190416ccd3 100644 --- a/pkg/crc/preflight/preflight_windows.go +++ b/pkg/crc/preflight/preflight_windows.go @@ -118,7 +118,7 @@ var adminHelperServiceCheks = []Check{ configKeySuffix: "check-admin-helper-service-running", checkDescription: "Checking admin helper service is running", check: checkIfAdminHelperServiceRunning, - fixDescription: "Make sure you installed crc using the Windows installer", + fixDescription: "Make sure you installed crc using the Windows installer and performed required reboot", flags: NoFix, labels: labels{Os: Windows},