Skip to content
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
4 changes: 2 additions & 2 deletions pkg/cidata/cidata.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ func GenerateISO9660(instDir, name string, y *limayaml.LimaYAML, udpDNSLocalPort
SlirpGateway: networks.SlirpGateway,
SlirpDNS: networks.SlirpDNS,
SlirpIPAddress: networks.SlirpIPAddress,
RosettaEnabled: y.Rosetta.Enabled,
RosettaBinFmt: y.Rosetta.BinFmt,
RosettaEnabled: *y.Rosetta.Enabled,
RosettaBinFmt: *y.Rosetta.BinFmt,
}

// change instance id on every boot so network config will be processed again
Expand Down
20 changes: 20 additions & 0 deletions pkg/limayaml/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,26 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {

caCerts := unique(append(append(d.CACertificates.Certs, y.CACertificates.Certs...), o.CACertificates.Certs...))
y.CACertificates.Certs = caCerts

if y.Rosetta.Enabled == nil {
y.Rosetta.Enabled = d.Rosetta.Enabled
}
if o.Rosetta.Enabled != nil {
y.Rosetta.Enabled = o.Rosetta.Enabled
}
if y.Rosetta.Enabled == nil {
y.Rosetta.Enabled = pointer.Bool(false)
}

if y.Rosetta.BinFmt == nil {
y.Rosetta.BinFmt = d.Rosetta.BinFmt
}
if o.Rosetta.BinFmt != nil {
y.Rosetta.BinFmt = o.Rosetta.BinFmt
}
if y.Rosetta.BinFmt == nil {
y.Rosetta.BinFmt = pointer.Bool(false)
}
}

func executeGuestTemplate(format string) (bytes.Buffer, error) {
Expand Down
23 changes: 23 additions & 0 deletions pkg/limayaml/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ func TestFillDefault(t *testing.T) {
},
}

expect.Rosetta = Rosetta{
Enabled: pointer.Bool(false),
BinFmt: pointer.Bool(false),
}

FillDefault(&y, &LimaYAML{}, &LimaYAML{}, filePath)
assert.DeepEqual(t, &y, &expect, opts...)

Expand Down Expand Up @@ -328,6 +333,10 @@ func TestFillDefault(t *testing.T) {
"-----BEGIN CERTIFICATE-----\nYOUR-ORGS-TRUSTED-CA-CERT\n-----END CERTIFICATE-----\n",
},
},
Rosetta: Rosetta{
Enabled: pointer.Bool(true),
BinFmt: pointer.Bool(true),
},
}

expect = d
Expand All @@ -350,6 +359,11 @@ func TestFillDefault(t *testing.T) {
"-----BEGIN CERTIFICATE-----\nYOUR-ORGS-TRUSTED-CA-CERT\n-----END CERTIFICATE-----\n",
}

expect.Rosetta = Rosetta{
Enabled: pointer.Bool(true),
BinFmt: pointer.Bool(true),
}

y = LimaYAML{}
FillDefault(&y, &d, &LimaYAML{}, filePath)
assert.DeepEqual(t, &y, &expect, opts...)
Expand Down Expand Up @@ -497,6 +511,10 @@ func TestFillDefault(t *testing.T) {
CACertificates: CACertificates{
RemoveDefaults: pointer.Bool(true),
},
Rosetta: Rosetta{
Enabled: pointer.Bool(false),
BinFmt: pointer.Bool(false),
},
}

y = filledDefaults
Expand Down Expand Up @@ -543,6 +561,11 @@ func TestFillDefault(t *testing.T) {
"-----BEGIN CERTIFICATE-----\nYOUR-ORGS-TRUSTED-CA-CERT\n-----END CERTIFICATE-----\n",
}

expect.Rosetta = Rosetta{
Enabled: pointer.Bool(false),
BinFmt: pointer.Bool(false),
}

FillDefault(&y, &d, &o, filePath)
assert.DeepEqual(t, &y, &expect, opts...)
}
4 changes: 2 additions & 2 deletions pkg/limayaml/limayaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ const (
)

type Rosetta struct {
Enabled bool `yaml:"enabled" json:"enabled"`
BinFmt bool `yaml:"binfmt" json:"binfmt"`
Enabled *bool `yaml:"enabled" json:"enabled"`
BinFmt *bool `yaml:"binfmt" json:"binfmt"`
}

type File struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/vz/vm_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func attachFolderMounts(driver *driver.BaseDriver, vmConfig *vz.VirtualMachineCo
}
}

if driver.Yaml.Rosetta.Enabled {
if *driver.Yaml.Rosetta.Enabled {
logrus.Info("Setting up Rosetta share")
directorySharingDeviceConfig, err := createRosettaDirectoryShareConfiguration()
if err != nil {
Expand Down