diff options
author | Brent Baude <bbaude@redhat.com> | 2020-04-16 12:25:26 -0500 |
---|---|---|
committer | Brent Baude <bbaude@redhat.com> | 2020-04-16 15:53:58 -0500 |
commit | 241326a9a8c20ad7f2bcf651416b836e7778e090 (patch) | |
tree | 4001e8e47a022bb1b9bfbf2332c42e1aeb802f9e /cmd/podmanV2/common/netflags.go | |
parent | 88c6fd06cd54fb9a8826306dfdf1a77e400de5de (diff) | |
download | podman-241326a9a8c20ad7f2bcf651416b836e7778e090.tar.gz podman-241326a9a8c20ad7f2bcf651416b836e7778e090.tar.bz2 podman-241326a9a8c20ad7f2bcf651416b836e7778e090.zip |
Podman V2 birth
remote podman v1 and replace with podman v2.
Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podmanV2/common/netflags.go')
-rw-r--r-- | cmd/podmanV2/common/netflags.go | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/cmd/podmanV2/common/netflags.go b/cmd/podmanV2/common/netflags.go deleted file mode 100644 index 41eed2988..000000000 --- a/cmd/podmanV2/common/netflags.go +++ /dev/null @@ -1,100 +0,0 @@ -package common - -import ( - "net" - - "github.com/containers/libpod/pkg/domain/entities" - "github.com/spf13/cobra" - "github.com/spf13/pflag" -) - -func GetNetFlags() *pflag.FlagSet { - netFlags := pflag.FlagSet{} - netFlags.StringSlice( - "add-host", []string{}, - "Add a custom host-to-IP mapping (host:ip) (default [])", - ) - netFlags.StringSlice( - "dns", getDefaultDNSServers(), - "Set custom DNS servers", - ) - netFlags.StringSlice( - "dns-opt", getDefaultDNSOptions(), - "Set custom DNS options", - ) - netFlags.StringSlice( - "dns-search", getDefaultDNSSearches(), - "Set custom DNS search domains", - ) - netFlags.String( - "ip", "", - "Specify a static IPv4 address for the container", - ) - netFlags.String( - "mac-address", "", - "Container MAC address (e.g. 92:d0:c6:0a:29:33)", - ) - netFlags.String( - "network", getDefaultNetNS(), - "Connect a container to a network", - ) - netFlags.StringSliceP( - "publish", "p", []string{}, - "Publish a container's port, or a range of ports, to the host (default [])", - ) - netFlags.Bool( - "no-hosts", false, - "Do not create /etc/hosts within the container, instead use the version from the image", - ) - return &netFlags -} - -func NetFlagsToNetOptions(cmd *cobra.Command) (*entities.NetOptions, error) { - var ( - err error - ) - opts := entities.NetOptions{} - opts.AddHosts, err = cmd.Flags().GetStringSlice("add-host") - if err != nil { - return nil, err - } - servers, err := cmd.Flags().GetStringSlice("dns") - if err != nil { - return nil, err - } - for _, d := range servers { - if d == "none" { - opts.DNSHost = true - break - } - opts.DNSServers = append(opts.DNSServers, net.ParseIP(d)) - } - opts.DNSSearch, err = cmd.Flags().GetStringSlice("dns-search") - if err != nil { - return nil, err - } - - m, err := cmd.Flags().GetString("mac-address") - if err != nil { - return nil, err - } - if len(m) > 0 { - mac, err := net.ParseMAC(m) - if err != nil { - return nil, err - } - opts.StaticMAC = &mac - } - inputPorts, err := cmd.Flags().GetStringSlice("publish") - if err != nil { - return nil, err - } - if len(inputPorts) > 0 { - opts.PublishPorts, err = createPortBindings(inputPorts) - if err != nil { - return nil, err - } - } - opts.NoHosts, err = cmd.Flags().GetBool("no-hosts") - return &opts, err -} |