From 76b54fb3fd7ab553b9bd7225ef4456eaddbc6c6a Mon Sep 17 00:00:00 2001 From: aramalipoor Date: Wed, 19 Aug 2015 21:35:11 +0430 Subject: [PATCH] bugfix(destroy): Do not check for container deleting errors --- controller/create.go | 2 +- farmer/box.go | 8 +------- farmer/farmer.go | 5 +---- farmer/parser.go | 2 +- reverse_proxy/domain.go | 2 +- 5 files changed, 5 insertions(+), 14 deletions(-) diff --git a/controller/create.go b/controller/create.go index e7a06d2..c2fcc6f 100644 --- a/controller/create.go +++ b/controller/create.go @@ -26,7 +26,7 @@ func BoxCreate(name string, repoUrl string, pathspec string, stream *hub.Stream) Pathspec: pathspec, CodeDirectory: os.Getenv("FARMER_BOX_DATA_LOCATION") + "/" + name, CgroupParent: "level1", - Status: "creating", + Status: "creating", } if err := db.DB.Save(&box).Error; err != nil { diff --git a/farmer/box.go b/farmer/box.go index d93c7a2..5d649d4 100644 --- a/farmer/box.go +++ b/farmer/box.go @@ -2,7 +2,6 @@ package farmer import ( "io" - "github.com/fsouza/go-dockerclient" ) type Box struct { @@ -60,12 +59,7 @@ func (b *Box) Deploy() error { } func (b *Box) Destroy() error { - if err := dockerDeleteContainer(b); err != nil { - if _, ok := err.(*docker.NoSuchContainer); !ok { - return err - } - } - + dockerDeleteContainer(b) return b.removeCode() } diff --git a/farmer/farmer.go b/farmer/farmer.go index 161add5..6980e12 100644 --- a/farmer/farmer.go +++ b/farmer/farmer.go @@ -18,10 +18,7 @@ func findBoxBy(field string, value interface{}) (*Box, error) { return box, err } - if err = box.Inspect(); err != nil { - return box, err - } - + box.Inspect() if err = db.DB.Model(&box).Related(&box.Domains).Error; err != nil { return box, err } diff --git a/farmer/parser.go b/farmer/parser.go index 82d7f97..e0c17ce 100644 --- a/farmer/parser.go +++ b/farmer/parser.go @@ -35,4 +35,4 @@ func setDefaultConfig(config *FarmerConfig) error { } return nil -} \ No newline at end of file +} diff --git a/reverse_proxy/domain.go b/reverse_proxy/domain.go index d6da052..336e81f 100644 --- a/reverse_proxy/domain.go +++ b/reverse_proxy/domain.go @@ -62,7 +62,7 @@ func checkDomain(url string) error { err := db.DB.Where("url = ?", url).Find(domain).Error if err != nil { // Could not find a domain so domain is available and free to use. - if (err.Error() == "record not found") { + if err.Error() == "record not found" { return nil } return err