Skip to content

Commit

Permalink
preflight: add check to see if admin-helper namedpipe is accessible
Browse files Browse the repository at this point in the history
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
  • Loading branch information
anjannath authored and praveenkumar committed May 10, 2023
1 parent 73a4b92 commit bb69afc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions pkg/crc/preflight/preflight_checks_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion pkg/crc/preflight/preflight_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit bb69afc

Please sign in to comment.