diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-10-10 14:04:17 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@gmail.com> | 2018-10-11 11:24:08 -0400 |
commit | 4882a6dd9dc8ee5475ce8a00c52a522e661dd387 (patch) | |
tree | de7eef31adc1396dad568de4a6242cdea01e8cee /pkg | |
parent | b3cde231abb1fe5c70aaf18f6f7540e6a123ae9d (diff) | |
download | podman-4882a6dd9dc8ee5475ce8a00c52a522e661dd387.tar.gz podman-4882a6dd9dc8ee5475ce8a00c52a522e661dd387.tar.bz2 podman-4882a6dd9dc8ee5475ce8a00c52a522e661dd387.zip |
Add --ip flag and plumbing into libpod
Add the --ip flag back with bash completions. Manpages still
missing.
Add plumbing to pass appropriate the appropriate option down to
libpod to connect the flag to backend logic added in the previous
commits.
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/spec/createconfig.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go index 887ef8e95..e9a5dc9dc 100644 --- a/pkg/spec/createconfig.go +++ b/pkg/spec/createconfig.go @@ -2,6 +2,7 @@ package createconfig import ( "encoding/json" + "net" "os" "strconv" "strings" @@ -311,9 +312,6 @@ func (c *CreateConfig) GetContainerCreateOptions(runtime *libpod.Runtime) ([]lib var pod *libpod.Pod var err error - // Uncomment after talking to mheon about unimplemented funcs - // options = append(options, libpod.WithLabels(c.labels)) - if c.Interactive { options = append(options, libpod.WithStdin()) } @@ -442,6 +440,15 @@ func (c *CreateConfig) GetContainerCreateOptions(runtime *libpod.Runtime) ([]lib if logPath != "" { options = append(options, libpod.WithLogPath(logPath)) } + if c.IPAddress != "" { + ip := net.ParseIP(c.IPAddress) + if ip == nil { + return nil, errors.Wrapf(libpod.ErrInvalidArg, "cannot parse %s as IP address", c.IPAddress) + } else if ip.To4() == nil { + return nil, errors.Wrapf(libpod.ErrInvalidArg, "%s is not an IPv4 address", c.IPAddress) + } + options = append(options, libpod.WithStaticIP(ip)) + } options = append(options, libpod.WithPrivileged(c.Privileged)) |