func (s *platformService) Rollback(opts appTypes.PlatformOptions) error {
	if opts.Name == "" {
		return appTypes.ErrPlatformNameMissing
	}
	if opts.ImageName == "" {
		return appTypes.ErrPlatformImageMissing
	}
	_, err := s.FindByName(opts.Name)
	if err != nil {
		return err
	}
	image, err := servicemanager.PlatformImage.FindImage(opts.Name, opts.ImageName)
	if err != nil {
		return err
	}
	if image == "" {
		return fmt.Errorf("Image %s not found in platform %q", opts.ImageName, opts.Name)
	}
	opts.Data = []byte("FROM " + image)
	opts.ImageName, err = servicemanager.PlatformImage.NewImage(opts.Name)
	if err != nil {
		return err
	}
	err = builder.PlatformUpdate(opts)
	if err != nil {
		return err
	}
	err = servicemanager.PlatformImage.AppendImage(opts.Name, opts.ImageName)
	if err != nil {
		return err
	}
	conn, err := db.Conn()
	if err != nil {
		return err
	}
	defer conn.Close()
	var apps []App
	err = conn.Apps().Find(bson.M{"framework": opts.Name}).All(&apps)
	if err != nil {
		return err
	}
	for _, app := range apps {
		app.SetUpdatePlatform(true)
	}
	return nil
}
func (s *platformService) Rollback(opts appTypes.PlatformOptions) error {
	if opts.Name == "" {
		return appTypes.ErrPlatformNameMissing
	}
	if opts.ImageName == "" {
		return appTypes.ErrPlatformImageMissing
	}
	_, err := s.FindByName(opts.Name)
	if err != nil {
		return err
	}
	image, err := servicemanager.PlatformImage.FindImage(opts.Name, opts.ImageName)
	if err != nil {
		return err
	}
	if image == "" {
		return fmt.Errorf("Image %s not found in platform %q", opts.ImageName, opts.Name)
	}
	opts.Data = []byte("FROM " + image)
	opts.ImageName, err = servicemanager.PlatformImage.NewImage(opts.Name)
	if err != nil {
		return err
	}
	err = builder.PlatformUpdate(opts)
	if err != nil {
		return err
	}
	err = servicemanager.PlatformImage.AppendImage(opts.Name, opts.ImageName)
	if err != nil {
		return err
	}
	conn, err := db.Conn()
	if err != nil {
		return err
	}
	defer conn.Close()
	var apps []App
	err = conn.Apps().Find(bson.M{"framework": opts.Name}).All(&apps)
	if err != nil {
		return err
	}
	for _, app := range apps {
		app.SetUpdatePlatform(true)
	}
	return nil
}
func ( s * platformService ) Rollback ( opts appTypes . PlatformOptions ) error { if opts . Name == " " { return appTypes . ErrPlatformNameMissing } if opts . ImageName == " " { return appTypes . ErrPlatformImageMissing } _ , err := s . FindByName ( opts . Name ) if err != nil { return err } image , err := servicemanager . PlatformImage . FindImage ( opts . Name , opts . ImageName ) if err != nil { return err } if image == " " { return fmt . Errorf ( " " , opts . ImageName , opts . Name ) } opts . Data = [ ] byte ( " " + image ) opts . ImageName , err = servicemanager . PlatformImage . NewImage ( opts . Name ) if err != nil { return err } err = builder . PlatformUpdate ( opts ) if err != nil { return err } err = servicemanager . PlatformImage . AppendImage ( opts . Name , opts . ImageName ) if err != nil { return err } conn , err := db . Conn ( ) if err != nil { return err } defer conn . Close ( ) var apps [ ] App err = conn . Apps ( ) . Find ( bson . M { " " : opts . Name } ) . All ( & apps ) if err != nil { return err } for _ , app := range apps { app . SetUpdatePlatform ( true ) } return nil }
// Rollback implements Rollback method of PlatformService interface
Rollback implements Rollback method of PlatformService interface