[PATCH conductor] Replace description xml with name image import
Tomas Sedovic
tsedovic at redhat.com
Mon Dec 19 12:38:45 UTC 2011
On 12/16/2011 05:04 PM, tsedovic at redhat.com wrote:
> From: Tomas Sedovic<tomas at sedovic.cz>
>
> https://bugzilla.redhat.com/show_bug.cgi?id=761282
>
> Right now the only thing that the description XML supports is setting the name
> anyway. When it can do more, we can properly document it and put it all back.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=761282
> ---
> src/app/controllers/images_controller.rb | 10 +---------
> src/app/views/images/import.html.haml | 4 ++--
> src/config/locales/en.yml | 3 +--
> 3 files changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb
> index 2adce72..ca8bedb 100644
> --- a/src/app/controllers/images_controller.rb
> +++ b/src/app/controllers/images_controller.rb
> @@ -82,15 +82,7 @@ class ImagesController< ApplicationController
>
> def import
> account = ProviderAccount.find(params[:provider_account])
> - begin
> - xml = Nokogiri::XML(CGI.unescapeHTML(params[:description_xml].read)).to_s
> - rescue Exception => e
> - if params[:description_xml].present?
> - flash[:warning] = t("images.import.bad_xml")
> - logger.error "XML was provided when importing image, but we are falling back on generic XML because we caught an exception: #{e.message}"
> - end
> - xml = nil # It'll be assigned in Image.import
> - end
> + xml = "<image><name>#{params[:name]}</name></image>" unless params[:name].blank?
> begin
> image = Image.import(account, params[:image_id], xml)
> flash[:success] = t("images.import.image_imported")
> diff --git a/src/app/views/images/import.html.haml b/src/app/views/images/import.html.haml
> index 8c20806..df3b421 100644
> --- a/src/app/views/images/import.html.haml
> +++ b/src/app/views/images/import.html.haml
> @@ -15,8 +15,8 @@
> = label_tag :image_id, t('.image_id')
> = text_field_tag :image_id
> %p
> - = label_tag :description, t('.description')
> - = file_field_tag :description_xml
> + = label_tag :name, t('.name')
> + = text_field_tag :name
>
> .buttons.container
> = submit_tag t(:continue), :id => "file_button", :class => "button primary"
> diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
> index 9f4742f..0744e2b 100644
> --- a/src/config/locales/en.yml
> +++ b/src/config/locales/en.yml
> @@ -675,8 +675,7 @@ en:
> import_image: Import Image
> provider_account: Provider Account
> image_id: Image ID
> - description: Image Description
> - bad_xml: Your image description could not be parsed and was ignored.
> + name: Image Name
> image_imported: The image was imported successfully.
> image_not_imported: The image could not be imported. Check the Image Factory log for further details.
> index:
Self-ack & pushed.
More information about the aeolus-devel
mailing list