summaryrefslogtreecommitdiff
path: root/pkg/specgenutil
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-11-03 14:54:48 +0100
committerPaul Holzinger <pholzing@redhat.com>2021-11-03 15:30:16 +0100
commit001d48929dcbe4f3a8eeb3db2a7bfdce5a90f81a (patch)
treec44bf5a4f6956f1d3900761079f452a9499f8af6 /pkg/specgenutil
parent82dba9754745f7598619050af4212a20b21821ad (diff)
downloadpodman-001d48929dcbe4f3a8eeb3db2a7bfdce5a90f81a.tar.gz
podman-001d48929dcbe4f3a8eeb3db2a7bfdce5a90f81a.tar.bz2
podman-001d48929dcbe4f3a8eeb3db2a7bfdce5a90f81a.zip
MAC address json unmarshal should allow strings
Create a new mac address type which supports json marshal/unmarshal from and to string. This change is backwards compatible with the previous versions as the unmarshal method still accepts the old byte array or base64 encoded string. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'pkg/specgenutil')
-rw-r--r--pkg/specgenutil/specgen.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/specgenutil/specgen.go b/pkg/specgenutil/specgen.go
index 683cd2918..4e8f954fb 100644
--- a/pkg/specgenutil/specgen.go
+++ b/pkg/specgenutil/specgen.go
@@ -11,6 +11,7 @@ import (
"github.com/containers/image/v5/manifest"
"github.com/containers/podman/v3/cmd/podman/parse"
"github.com/containers/podman/v3/libpod/define"
+ "github.com/containers/podman/v3/libpod/network/types"
ann "github.com/containers/podman/v3/pkg/annotations"
"github.com/containers/podman/v3/pkg/domain/entities"
envLib "github.com/containers/podman/v3/pkg/env"
@@ -457,7 +458,8 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *entities.ContainerCreateOptions
s.DNSSearch = c.Net.DNSSearch
s.DNSOptions = c.Net.DNSOptions
s.StaticIP = c.Net.StaticIP
- s.StaticMAC = c.Net.StaticMAC
+ // type cast to types.HardwareAddr
+ s.StaticMAC = (*types.HardwareAddr)(c.Net.StaticMAC)
s.NetworkOptions = c.Net.NetworkOptions
s.UseImageHosts = c.Net.NoHosts
}