--- a/docker/network.go Sat Oct 26 14:37:40 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-// Copyright 2016-2018 Gary Kramlich <grim@reaperworld.com>
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
- log "github.com/sirupsen/logrus"
- "bitbucket.org/rw_grim/convey/logging"
- "bitbucket.org/rw_grim/convey/runtime"
- "bitbucket.org/rw_grim/convey/util"
-// Network represents a docker network.
-// NewNetwork creates a new docker network.
-func NewNetwork(rt *runtime.Runtime) (*Network, error) {
- logger: logging.NewAdapter("network"),
- cmdv := []string{"network", "create", network.name}
- _, _, err := DockerOutput("create network", cmdv, rt)
- network.logger.Debugf("created network: %#v", network.name)
-// Name returns the name of the network.
-func (network *Network) Name() string {
-// Destroy tears down the docker network.
-func (network *Network) Destroy() error {
- for _, name := range network.rt.Containers.GetRunning() {
- network.logger.Infof("disconnecting container %s from network %s", name, network.Name())
- err := Docker("disconnect container", cmdv, network.rt)
- msgFmt := "failed to disconnect container %s from network %s"
- network.logger.Warningf(msgFmt, name, network.Name())
- msgFmt := "disconnected container %s from network %s"
- network.logger.Infof(msgFmt, name, network.Name())
- // monkey with the timeout so our cleanup always runs
- oldTimeout := network.rt.State.PlanTimeout
- network.rt.State.PlanTimeout = oldTimeout
- network.rt.State.PlanTimeout = 15 * time.Minute
- cmdv := []string{"network", "rm", network.name}
- return Docker("remove network", cmdv, network.rt)