From b38d6b1cdeb93a3d94d99f7e3343f3b1ea06b93b Mon Sep 17 00:00:00 2001 From: yangxg Date: Fri, 11 Oct 2024 18:24:41 +0800 Subject: [PATCH] fix: sealos reset panic (#5147) 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 {