diff options
author | Paul Holzinger <pholzing@redhat.com> | 2021-09-02 09:25:36 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2021-09-07 10:24:10 +0200 |
commit | 3d02cfb5e05e14050f47ee446d3ed23d0948b90c (patch) | |
tree | 433afc0c842c0ec6ce838c02a71fdad9fc53c80b /cmd/podman/networks/create.go | |
parent | 4207d959a68c1ee2b805b7113838580c14f4bbc6 (diff) | |
download | podman-3d02cfb5e05e14050f47ee446d3ed23d0948b90c.tar.gz podman-3d02cfb5e05e14050f47ee446d3ed23d0948b90c.tar.bz2 podman-3d02cfb5e05e14050f47ee446d3ed23d0948b90c.zip |
network create: add warning for deprecated macvlan flag
The macvlan driver is not deprecated, only the --macvlan flag is.
Remove the flag from the man page since it is deprecated and add a
warning to podman network create if it is used.
[NO TESTS NEEDED]
Fixes #11400
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'cmd/podman/networks/create.go')
-rw-r--r-- | cmd/podman/networks/create.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cmd/podman/networks/create.go b/cmd/podman/networks/create.go index 1f3b321ba..b5ddd215f 100644 --- a/cmd/podman/networks/create.go +++ b/cmd/podman/networks/create.go @@ -11,6 +11,7 @@ import ( "github.com/containers/podman/v3/libpod/define" "github.com/containers/podman/v3/pkg/domain/entities" "github.com/pkg/errors" + "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -56,7 +57,8 @@ func networkCreateFlags(cmd *cobra.Command) { macvlanFlagName := "macvlan" flags.StringVar(&networkCreateOptions.MacVLAN, macvlanFlagName, "", "create a Macvlan connection based on this device") - _ = cmd.RegisterFlagCompletionFunc(macvlanFlagName, completion.AutocompleteNone) + // This option is deprecated + flags.MarkHidden(macvlanFlagName) labelFlagName := "label" flags.StringArrayVar(&labels, labelFlagName, nil, "set metadata on a network") @@ -100,6 +102,11 @@ func networkCreate(cmd *cobra.Command, args []string) error { if err != nil { return errors.Wrapf(err, "unable to process options") } + + if networkCreateOptions.MacVLAN != "" { + logrus.Warn("The --macvlan option is deprecated, use `--driver macvlan --opt parent=<device>` instead") + } + response, err := registry.ContainerEngine().NetworkCreate(registry.Context(), name, networkCreateOptions) if err != nil { return err |