From d1abdebdcdcabbe5f702a31a1958ed1235839db9 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Fri, 2 Mar 2018 12:35:34 -0500 Subject: Remove unused existing IP addresses function Signed-off-by: Matthew Heon Closes: #440 Approved by: baude --- libpod/container.go | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) (limited to 'libpod/container.go') diff --git a/libpod/container.go b/libpod/container.go index 0e57f7296..b6c3d1f40 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -663,7 +663,7 @@ func (c *Container) IPs() ([]net.IPNet, error) { } if !c.config.CreateNetNS { - return errors.Wrapf(ErrInvalidArg, "container %s network namespace is not managed by libpod") + return nil, errors.Wrapf(ErrInvalidArg, "container %s network namespace is not managed by libpod") } ips := make([]net.IPNet, 0, len(c.state.IPs)) @@ -688,12 +688,12 @@ func (c *Container) Routes() ([]types.Route, error) { } } - routes := make([]types.Route, 0, len(c.state.Routes)) - if !c.config.CreateNetNS { - return errors.Wrapf(ErrInvalidArg, "container %s network namespace is not managed by libpod") + return nil, errors.Wrapf(ErrInvalidArg, "container %s network namespace is not managed by libpod") } + routes := make([]types.Route, 0, len(c.state.Routes)) + for _, route := range c.state.Routes { newRoute := types.Route{ Dst: route.Dst, @@ -709,25 +709,6 @@ func (c *Container) Routes() ([]types.Route, error) { // Misc Accessors // Most will require locking -// IPAddress returns the IP address of the container -// If the container does not have a network namespace, an error will be returned -func (c *Container) IPAddress() (net.IP, error) { - if !c.locked { - c.lock.Lock() - defer c.lock.Unlock() - - if err := c.syncContainer(); err != nil { - return nil, errors.Wrapf(err, "error updating container %s state", c.ID()) - } - } - - if !c.config.CreateNetNS || c.state.NetNS == nil { - return nil, errors.Wrapf(ErrInvalidArg, "container %s does not have a network namespace", c.ID()) - } - - return c.runtime.getContainerIP(c) -} - // NamespacePath returns the path of one of the container's namespaces // If the container is not running, an error will be returned func (c *Container) NamespacePath(ns LinuxNS) (string, error) { -- cgit v1.2.3-54-g00ecf