Skip to content

Commit

Permalink
fix an idempotency problem when we left cruft after a faild build
Browse files Browse the repository at this point in the history
  • Loading branch information
lyondhill committed Jun 1, 2017
1 parent 7f7e275 commit cea82bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions processors/code/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ func Setup(appModel *models.App, componentModel *models.Component, warehouseConf

// create docker container
config := container_generator.ComponentConfig(componentModel)
// remove any container that may have been created with this name befor
// this can happen if the process is killed after the
// container was created but before our db model was saved
docker.ContainerRemove(config.Name)

container, err := docker.CreateContainer(config)
if err != nil {
lumber.Error("code:Setup:createContainer:docker.CreateContainer(%+v)", config)
Expand Down
6 changes: 6 additions & 0 deletions processors/component/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ func Setup(appModel *models.App, componentModel *models.Component) error {
// start the container
display.StartTask("Starting docker container")
config := container_generator.ComponentConfig(componentModel)

// remove any container that may have been created with this name befor
// this can happen if the process is killed after the
// container was created but before our db model was saved
docker.ContainerRemove(config.Name)

container, err := docker.CreateContainer(config)
if err != nil {
lumber.Error("component:Setup:docker.CreateContainer(%+v): %s", config, err.Error())
Expand Down

0 comments on commit cea82bf

Please sign in to comment.