harvester / harvester

Open source hyperconverged infrastructure (HCI) software
https://harvesterhci.io/
Apache License 2.0
3.81k stars 320 forks source link

[BUG] harvester-installer: errors in validateConfig, PrepareWebooks and doInstall appear in console, but aren't logged #6214

Closed tserong closed 2 weeks ago

tserong commented 2 months ago

Describe the bug The last chunk of code in the install panel's PreShow() function calls validateConfig(), PrepareWebhooks() and one of configureInstalledNode() or doInstall(). All these functions return an error value in err, but if err is set, all we do is call printToPanel() - we never actually log the error:

https://github.com/harvester/harvester-installer/blob/36ea2bf0c7f4e420b5ca4f1d1a75312240d1f9bc/pkg/console/install_panels.go#L2168-L2184

This means if you're using the installer interactively and one of these things fails, you can see what went wrong on the console display. But, if you're doing a PXE install and any of these things fail, and for some reason you can't see the console and can only access the log in /var/log/console.log you will have no idea what went wrong.

To Reproduce Steps to reproduce the behavior:

  1. Set up a PXE install (e.g. vagrant-pxe-harvester from https://github.com/harvester/ipxe-examples), but mess up the config somehow, for example:
    install:
     mode: This ain't right
  2. Boot a node, and confirm that the installation fails by checking the console: image
  3. Check /var/log/console.log and note that there's no indication of the actual problem - in this example all we see is some preflight check failures which is quite misleading: image

Expected behavior Whatever failed is actually logged.

Support bundle N/A

Environment

Additional context N/A

harvesterhci-io-github-bot commented 2 months ago

added backport-needed/1.3.2 issue: #6215.

harvesterhci-io-github-bot commented 2 months ago

Pre Ready-For-Testing Checklist

harvesterhci-io-github-bot commented 2 months ago

Automation e2e test issue: harvester/tests#1401

irishgordo commented 2 weeks ago

@tserong thanks for this enhancment :smile: :+1: - this all looks good - I'll go ahead and close this out :smile:

Environment

Verification

1 Node Cluster

  1. :green_circle: Logs are more useful given strange parameters in Harvester configuration at Install time w/ Harvester Installer

    Given a strange harvester install mode is specified
    • our installer should be logging out the content of what has happened giving us more depth in the console about the yaml configuration it was provided
    ![Screenshot from 2024-10-01 13-49-12](https://github.com/user-attachments/assets/c4c8aa48-49ab-4af4-b775-4701769a53ee) ![Screenshot from 2024-10-01 13-45-48](https://github.com/user-attachments/assets/85d5d201-c8ec-4e43-a665-fe966566727e)