Created
May 6, 2011 01:36
-
-
Save harukizaemon/958308 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def retry | |
| @tpl = Template.find(params[:template_id]) | |
| check_permission | |
| begin | |
| if params[:image_id] | |
| image = Image.find(params[:image_id]) | |
| if image | |
| errors = {} | |
| warnings = [] | |
| image.rebuild! | |
| flash[:notice] = "Queued rebuild for image #{image.name}" | |
| else | |
| flash[:warning] = "could not find image #{image_id}" | |
| end | |
| elsif params[:provider_image_id] | |
| provider_image = ProviderImage.find(params[:provider_image_id]) | |
| if provider_image | |
| provider_image.retry_upload! | |
| flash[:notice] = "Queued upload of provider image #{provider_image.image.name} to #{provider_image.provider.name}" | |
| else | |
| flash[:warning] = "could not find provider image #{provider_image_id}" | |
| end | |
| else | |
| flash[:warning] = 'You need to specify either a provider or a provider image' | |
| end | |
| rescue | |
| flash[:warning] = $!.message | |
| logger.error $!.message | |
| logger.error $!.backtrace.join("\n ") | |
| end | |
| redirect_to image_factory_template_path(@tpl, :details_tab => 'builds') | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment