Skip to content

Commit

Permalink
Merge pull request #273 from rancher-sandbox/always-first-boot
Browse files Browse the repository at this point in the history
Change instance id on every start
  • Loading branch information
AkihiroSuda authored Sep 28, 2021
2 parents 6fd2824 + ab0dfc7 commit 766a83e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/cidata/cidata.TEMPLATE.d/meta-data
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
instance-id: {{.IID}}
local-hostname: lima-{{.Name}}
4 changes: 4 additions & 0 deletions pkg/cidata/cidata.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"path/filepath"
"strconv"
"strings"
"time"

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

// change instance id on every boot so network config will be processed again
args.IID = fmt.Sprintf("iid-%d", time.Now().Unix())

pubKeys, err := sshutil.DefaultPubKeys(*y.SSH.LoadDotSSHPubKeys)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions pkg/cidata/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type Network struct {
}
type TemplateArgs struct {
Name string // instance name
IID string // instance id
User string // user name
UID int
SSHPubKeys []string
Expand Down

0 comments on commit 766a83e

Please sign in to comment.