From 1cd2b746d0d6a4e8c074bc444b4a4a2afef30d5d Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Mon, 20 Apr 2020 15:32:46 -0400 Subject: Modify namespace generation code for specgen Namespaces have now been changed to properly handle all cases. Spec handling code for namespaces was consolidated in a single function. Still missing: - Image ports - Pod namespaces likely still broken in Podmanv2 Signed-off-by: Matthew Heon --- cmd/podman/common/netflags.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'cmd/podman/common') diff --git a/cmd/podman/common/netflags.go b/cmd/podman/common/netflags.go index 1a47733e7..a439eb792 100644 --- a/cmd/podman/common/netflags.go +++ b/cmd/podman/common/netflags.go @@ -5,6 +5,7 @@ import ( "github.com/containers/libpod/cmd/podman/parse" "github.com/containers/libpod/pkg/domain/entities" + "github.com/containers/libpod/pkg/specgen" "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/pflag" @@ -159,9 +160,13 @@ func NetFlagsToNetOptions(cmd *cobra.Command) (*entities.NetOptions, error) { return nil, err } - return nil, errors.Errorf("network %s is not yet supported", network) - // TODO How do I convert a string network to a Specgen.Namespace? - // opts.Network = specgen.Namespace{NSMode: network} + ns, cniNets, err := specgen.ParseNetworkNamespace(network) + if err != nil { + return nil, err + } + + opts.Network = ns + opts.CNINetworks = cniNets } return &opts, err -- cgit v1.2.3-54-g00ecf