From c54020302f04512799ec841a8efb82da08f7a1a6 Mon Sep 17 00:00:00 2001 From: TrungBui59 Date: Tue, 5 Sep 2023 20:19:09 -0400 Subject: [PATCH] Fixing host_gateway_ip to follow nerdctl standard Signed-off-by: TrungBui59 --- pkg/config/config.go | 2 +- pkg/config/nerdctl_config_applier.go | 4 ++-- pkg/config/nerdctl_config_applier_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 1af016c5d..0a3fbef7d 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -55,7 +55,7 @@ type Finch struct { // Has no effect on systems where Rosetta 2 is not available (Intel/AMD64 macs, or macOS < 13.0). // This setting will only be applied on vm init. Rosetta *bool `yaml:"rosetta,omitempty"` - HostGatewayIp *string `yaml:"host_gateway_ip,omitempty"` + HostGatewayIP *string `yaml:"host_gateway_ip,omitempty"` } // Nerdctl is a copy from github.com/containerd/nerdctl/cmd/nerdctl/main.go diff --git a/pkg/config/nerdctl_config_applier.go b/pkg/config/nerdctl_config_applier.go index 2e637c1d5..916c99d23 100644 --- a/pkg/config/nerdctl_config_applier.go +++ b/pkg/config/nerdctl_config_applier.go @@ -127,8 +127,8 @@ func updateNerdctlConfig(fc *Finch, fs afero.Fs, user string, rootless bool) err cfg.Namespace = nerdctlNamespace cfg.HostGatewayIP = "192.168.5.2" - if fc.HostGatewayIp != nil { - cfg.HostGatewayIP = *fc.HostGatewayIp + if fc.HostGatewayIP != nil { + cfg.HostGatewayIP = *fc.HostGatewayIP } updatedCfg, err := toml.Marshal(cfg) diff --git a/pkg/config/nerdctl_config_applier_test.go b/pkg/config/nerdctl_config_applier_test.go index 8e94db8cf..2ac67ec4d 100644 --- a/pkg/config/nerdctl_config_applier_test.go +++ b/pkg/config/nerdctl_config_applier_test.go @@ -185,7 +185,7 @@ func Test_updateNerdctlConfig(t *testing.T) { Memory: pointer.String("4GiB"), VMType: pointer.String("qemu"), Rosetta: pointer.Bool(false), - HostGatewayIp: pointer.String("192.168.31.1"), + HostGatewayIP: pointer.String("192.168.31.1"), } t.Run(tc.name, func(t *testing.T) { t.Parallel()