Deploy will automatically create a route if it doesn't exist.

This commit is contained in:
Travis Reeder
2017-05-17 15:11:44 -07:00
parent ad9e692fda
commit fedf08964e
7 changed files with 75 additions and 53 deletions

View File

@@ -46,6 +46,7 @@ func (s *Server) handleRouteUpdate(c *gin.Context) {
}
if wroute.Route.Image != "" {
// This was checking that an image exists, but it's too slow of an operation. Checks at runtime now.
// err = s.Runner.EnsureImageExists(ctx, &task.Config{
// Image: wroute.Route.Image,
// })
@@ -57,6 +58,10 @@ func (s *Server) handleRouteUpdate(c *gin.Context) {
}
route, err := s.Datastore.UpdateRoute(ctx, wroute.Route)
if err == models.ErrRoutesNotFound {
// try insert then
route, err = s.Datastore.InsertRoute(ctx, wroute.Route)
}
if err != nil {
handleErrorResponse(c, err)
return