Skip to content

Commit

Permalink
fix(run): Initialize env map if nil
Browse files Browse the repository at this point in the history
PR 1575 introduced env variables from docker, but there
was no guarantee that the machine env map was ever initialized
at this point.

Signed-off-by: Luca Seritan <[email protected]>
  • Loading branch information
LucaSeri committed Apr 28, 2024
1 parent eaa3781 commit e193e08
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/cli/kraft/run/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,9 @@ func (opts *RunOptions) prepareRootfs(ctx context.Context, machine *machineapi.M
return fmt.Errorf("could not prepare initramfs: %w", err)
}

if machine.Spec.Env == nil {
machine.Spec.Env = make(map[string]string)
}
treemodel, err := processtree.NewProcessTree(
ctx,
[]processtree.ProcessTreeOption{
Expand Down

0 comments on commit e193e08

Please sign in to comment.