HostPreflight hostOS collector does not run on Amazon Linux 2023
xavpaice opened this issue · 1 comments
Bug Description
When running host preflights, the hostOS collector does not respond correctly when run on Amazon Linux 2023
./preflight https://raw.githubusercontent.com/replicatedhq/kURL/main/addons/containerd/1.6.9/host-preflight.yaml
* [Host OS Info] Running collector...
Error: no data has been collected
Expected Behavior
The hostOS
collector should run successfully.
Steps To Reproduce
Create a VM running Amazon Linux 2023.
Obtain the latest preflight binary (by whichever means is convenient)
Use the following as a preflight spec:
apiVersion: troubleshoot.sh/v1beta2
kind: HostPreflight
metadata:
name: hostOS
spec:
collectors:
- hostOS: {}
analyzers:
- hostOS:
outcomes:
- pass:
when: "centos = 7"
message: "CentOS 7 is supported"
- pass:
when: "centos = 8"
message: "CentOS 8 is supported"
- fail:
when: "ubuntu = 16.04"
message: "Ubuntu 16.04 is not supported"
- pass:
when: "ubuntu = 18.04"
message: "Ubuntu 18.04 is supported"
- pass:
when: "ubuntu = 20.04"
message: "Ubuntu 20.04 is supported"
Additional Context
Include the following information.
- Troubleshoot version: 0.76.2
- Operating system: Amazon Linux
- Operating system version: 2023
This is the intended behaviour, but the error message is misleading. It ought to be something like completed with no analysis results
. The spec has no default outcome so not analysis results are reported. If you are to have it look like below, it will work. Note the last message: "No supported OS found"
outcome which is the default/catch-all since it has no when
condition
apiVersion: troubleshoot.sh/v1beta2
kind: HostPreflight
metadata:
name: hostOS
spec:
collectors:
- hostOS: {}
analyzers:
- hostOS:
outcomes:
- pass:
when: "centos = 7"
message: "CentOS 7 is supported"
- pass:
when: "centos = 8"
message: "CentOS 8 is supported"
- fail:
when: "ubuntu = 16.04"
message: "Ubuntu 16.04 is not supported"
- pass:
when: "ubuntu = 18.04"
message: "Ubuntu 18.04 is supported"
- pass:
when: "ubuntu = 20.04"
message: "Ubuntu 20.04 is supported"
- fail:
message: "No supported OS found"
There has to be an explicit default outcome cause we cannot assume pass
, fail
or warn
.
I wonder whether preflight
should succeed in such cases for consistency, but not have any results in the analysis.json
file. I say so cause if there was another analyser that generated an outcome, this preflight run would succeed but have 1
outcome, not 2
as would be expected.
I wonder if we should log a warning if an analysis ends up with no outcome. This would help troubleshoot specs. In future we can validate specs.