Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change instance id on every start #273

Merged
merged 1 commit into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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