From f4afa37c23b90a6f2801f8fcf31899723725d41f Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Wed, 25 Oct 2023 14:34:45 +0200 Subject: [PATCH] pkg/config: turn PastaOptions into attributedstring.Slice Signed-off-by: Valentin Rothberg --- common/libnetwork/pasta/pasta.go | 2 +- common/pkg/config/config.go | 2 +- common/pkg/config/config_local_test.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/libnetwork/pasta/pasta.go b/common/libnetwork/pasta/pasta.go index 6a53afe3d4..b787a7814c 100644 --- a/common/libnetwork/pasta/pasta.go +++ b/common/libnetwork/pasta/pasta.go @@ -84,7 +84,7 @@ func Setup(opts *SetupOptions) error { } // first append options set in the config - cmdArgs = append(cmdArgs, opts.Config.Network.PastaOptions...) + cmdArgs = append(cmdArgs, opts.Config.Network.PastaOptions.Get()...) // then append the ones that were set on the cli cmdArgs = append(cmdArgs, opts.ExtraOptions...) diff --git a/common/pkg/config/config.go b/common/pkg/config/config.go index 284612f921..943102b5af 100644 --- a/common/pkg/config/config.go +++ b/common/pkg/config/config.go @@ -598,7 +598,7 @@ type NetworkConfig struct { // PastaOptions contains a default list of pasta(1) options that should // be used when running pasta. - PastaOptions []string `toml:"pasta_options,omitempty"` + PastaOptions attributedstring.Slice `toml:"pasta_options,omitempty"` } type SubnetPool struct { diff --git a/common/pkg/config/config_local_test.go b/common/pkg/config/config_local_test.go index d643100db0..8c11d2cb3e 100644 --- a/common/pkg/config/config_local_test.go +++ b/common/pkg/config/config_local_test.go @@ -129,12 +129,12 @@ var _ = Describe("Config Local", func() { // Given config, err := New(nil) gomega.Expect(err).To(gomega.BeNil()) - gomega.Expect(config.Network.PastaOptions).To(gomega.BeNil()) + gomega.Expect(config.Network.PastaOptions.Values).To(gomega.BeNil()) // When config2, err := NewConfig("testdata/containers_default.conf") // Then gomega.Expect(err).To(gomega.BeNil()) - gomega.Expect(config2.Network.PastaOptions).To(gomega.Equal([]string{"-t", "auto"})) + gomega.Expect(config2.Network.PastaOptions.Get()).To(gomega.Equal([]string{"-t", "auto"})) }) It("parse default_rootless_network_cmd", func() {