Skip to content

Commit

Permalink
fix: --env not work during sealos run (#4140) (#4145)
Browse files Browse the repository at this point in the history
Signed-off-by: fengxsong <fengxsong@outlook.com>
Co-authored-by: fengxsong <fengxsong@outlook.com>
  • Loading branch information
sealos-ci-robot and fengxsong committed Oct 23, 2023
1 parent 04c81fe commit e1a099e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/guest/guest.go
Expand Up @@ -43,7 +43,7 @@ func NewGuestManager() (Interface, error) {
}

func (d *Default) Apply(cluster *v2.Cluster, mounts []v2.MountImage, targetHosts []string) error {
envWrapper := env.NewEnvProcessor(cluster)
envGetter := env.NewEnvProcessor(cluster)
sshClient := ssh.NewCacheClientFromCluster(cluster, true)
execer, err := exec.New(sshClient)
if err != nil {
Expand All @@ -56,7 +56,7 @@ func (d *Default) Apply(cluster *v2.Cluster, mounts []v2.MountImage, targetHosts
eg, ctx := errgroup.WithContext(context.Background())
for j := range targetHosts {
node := targetHosts[j]
envs := envWrapper.Getenv(node)
envs := maps.Merge(m.Env, envGetter.Getenv(node))
cmds := formalizeImageCommands(cluster, i, m, envs)
eg.Go(func() error {
return execer.CmdAsyncWithContext(ctx, node,
Expand All @@ -69,7 +69,7 @@ func (d *Default) Apply(cluster *v2.Cluster, mounts []v2.MountImage, targetHosts
}
case m.IsApplication():
// on run on the first master
envs := envWrapper.Getenv(cluster.GetMaster0IP())
envs := maps.Merge(m.Env, envGetter.Getenv(cluster.GetMaster0IP()))
cmds := formalizeImageCommands(cluster, i, m, envs)
if err := execer.CmdAsync(cluster.GetMaster0IPAndPort(),
stringsutil.RenderShellWithEnv(strings.Join(cmds, "; "), envs),
Expand Down

0 comments on commit e1a099e

Please sign in to comment.