mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-08 18:05:41 +00:00
We were not handling the parsing of --ip. This pr adds validation checks and now will support the flag. Move validation to the actual parsing of the network flags. We should only parse the dns flags if the user changed them. We don't want to pass default options if set in containers.conf to the server. Potential for duplicating defaults. Add support for --dns-opt flag passing Begin handling of --network flag, although we don't have a way right now to translate a string into a specgen.Namespace. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
30 lines
776 B
Go
30 lines
776 B
Go
package common
|
|
|
|
import (
|
|
"github.com/containers/libpod/pkg/util"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
// validate determines if the flags and values given by the user are valid. things checked
|
|
// by validate must not need any state information on the flag (i.e. changed)
|
|
func (c *ContainerCLIOpts) validate() error {
|
|
var ()
|
|
if c.Rm && c.Restart != "" && c.Restart != "no" {
|
|
return errors.Errorf("the --rm option conflicts with --restart")
|
|
}
|
|
|
|
if _, err := util.ValidatePullType(c.Pull); err != nil {
|
|
return err
|
|
}
|
|
|
|
var imageVolType = map[string]string{
|
|
"bind": "",
|
|
"tmpfs": "",
|
|
"ignore": "",
|
|
}
|
|
if _, ok := imageVolType[c.ImageVolume]; !ok {
|
|
return errors.Errorf("invalid image-volume type %q. Pick one of bind, tmpfs, or ignore", c.ImageVolume)
|
|
}
|
|
return nil
|
|
|
|
}
|