Skip to content

Commit 766a83e

Browse files
authored
Merge pull request #273 from rancher-sandbox/always-first-boot
Change instance id on every start
2 parents 6fd2824 + ab0dfc7 commit 766a83e

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
instance-id: {{.IID}}
12
local-hostname: lima-{{.Name}}

pkg/cidata/cidata.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"path/filepath"
1111
"strconv"
1212
"strings"
13+
"time"
1314

1415
"github.com/lima-vm/lima/pkg/downloader"
1516
"github.com/lima-vm/lima/pkg/iso9660util"
@@ -57,6 +58,9 @@ func GenerateISO9660(instDir, name string, y *limayaml.LimaYAML) error {
5758
Env: y.Env,
5859
}
5960

61+
// change instance id on every boot so network config will be processed again
62+
args.IID = fmt.Sprintf("iid-%d", time.Now().Unix())
63+
6064
pubKeys, err := sshutil.DefaultPubKeys(*y.SSH.LoadDotSSHPubKeys)
6165
if err != nil {
6266
return err

pkg/cidata/template.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ type Network struct {
2929
}
3030
type TemplateArgs struct {
3131
Name string // instance name
32+
IID string // instance id
3233
User string // user name
3334
UID int
3435
SSHPubKeys []string

0 commit comments

Comments
 (0)