Exemple #1
0
func (s *S) TestValidListAppImages(c *check.C) {
	config.Set("docker:image-history-size", 2)
	defer config.Unset("docker:image-history-size")
	err := image.AppendAppImageName("myapp", "tsuru/app-myapp:v1")
	c.Assert(err, check.IsNil)
	err = image.AppendAppImageName("myapp", "tsuru/app-myapp:v2")
	c.Assert(err, check.IsNil)
	err = image.AppendAppImageName("myapp", "tsuru/app-myapp:v3")
	c.Assert(err, check.IsNil)
	images, err := image.ListValidAppImages("myapp")
	c.Assert(err, check.IsNil)
	c.Assert(images, check.DeepEquals, []string{"tsuru/app-myapp:v2", "tsuru/app-myapp:v3"})
}
Exemple #2
0
func (p *dockerProvisioner) Rollback(a provision.App, imageId string, evt *event.Event) (string, error) {
	validImgs, err := image.ListValidAppImages(a.GetName())
	if err != nil {
		return "", err
	}
	valid := false
	for _, img := range validImgs {
		if img == imageId {
			valid = true
			break
		}
	}
	if !valid {
		return "", errors.Errorf("Image %q not found in app", imageId)
	}
	return imageId, p.deploy(a, imageId, evt)
}