Skip to content

Commit

Permalink
bugfix(destroy): Do not check for container deleting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aramalipoor committed Aug 19, 2015
1 parent 2a0ac4f commit 76b54fb
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion controller/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 1 addition & 7 deletions farmer/box.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package farmer

import (
"io"
"github.com/fsouza/go-dockerclient"
)

type Box struct {
Expand Down Expand Up @@ -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()
}

Expand Down
5 changes: 1 addition & 4 deletions farmer/farmer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion farmer/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ func setDefaultConfig(config *FarmerConfig) error {
}

return nil
}
}
2 changes: 1 addition & 1 deletion reverse_proxy/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 76b54fb

Please sign in to comment.