zarf-dev / zarf

DevSecOps for Air Gap & Limited-Connection Systems. https://zarf.dev/
Apache License 2.0
1.4k stars 170 forks source link

Zarf destroy panic #2700

Open phillebaba opened 3 months ago

phillebaba commented 3 months ago

Environment

Device and OS: Arch Linux App version: v0.35.0 Kubernetes distro being used: N/A Other:

Steps to reproduce

  1. Run zarf destroy --confirm against a cluster where Zarf is not installed.

Expected result

The command should either error or should exit immediatly.

Actual Result

Panics due to a nil pointer in the state.

Visual Proof (screenshots, videos, text, etc)

Severity/Priority

Low/Medium

Additional Context

N/A

phillebaba commented 3 months ago

The easy solution to this problem is to just to check if state is nil before the other state check. I do however think it is slightly weird to delete a k3s cluster blindly without any user input just because the scripts are located at a specific file location.

https://github.com/defenseunicorns/zarf/blob/7288cf2b6c40570d84128fd4ec6673a3277aedee/src/cmd/destroy.go#L42-L56