From 7c0ee36651b798b027672d89d3b6b69c2c83faed Mon Sep 17 00:00:00 2001 From: yangxg Date: Fri, 11 Oct 2024 17:16:37 +0800 Subject: [PATCH] fix: sealos reset panic Signed-off-by: yangxg --- pkg/bootstrap/context.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/bootstrap/context.go b/pkg/bootstrap/context.go index 83046018117..d89676af3db 100644 --- a/pkg/bootstrap/context.go +++ b/pkg/bootstrap/context.go @@ -68,7 +68,10 @@ func NewContextFrom(cluster *v2.Cluster) Context { remoter := ssh.NewRemoteFromSSH(cluster.GetName(), execer) rootfsImage := cluster.GetRootfsImage() - rootfsEnvs := v2.MergeEnvWithBuiltinKeys(rootfsImage.Env, *rootfsImage) + var rootfsEnvs map[string]string + if rootfsImage != nil { + rootfsEnvs = v2.MergeEnvWithBuiltinKeys(rootfsImage.Env, *rootfsImage) + } // bootstrap process depends on the envs in the rootfs image shellWrapper := func(host, shell string) string {