[PATCH conductor 2/2] Architecture is displayed for imported images.
Matt Wagner
matt.wagner at redhat.com
Tue Feb 28 16:33:27 UTC 2012
Part of https://bugzilla.redhat.com/show_bug.cgi?id=795743
---
src/app/models/instance.rb | 2 +-
src/app/views/api/images/_image.xml.haml | 2 +-
src/app/views/images/_list.html.haml | 2 +-
src/spec/controllers/api/images_controller_spec.rb | 3 ++-
4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index 9027e24..13ff13b 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -369,7 +369,7 @@ class Instance < ActiveRecord::Base
# try to get architecture of the image associated with this instance
# for imported images template is empty -> architecture is not set,
# in this case we omit this check
- return image.os.arch
+ return image.architecture
rescue
logger.warn "failed to get image architecture for instance '#{name}', skipping architecture check: #{$!}"
logger.warn $!.backtrace.join("\n ")
diff --git a/src/app/views/api/images/_image.xml.haml b/src/app/views/api/images/_image.xml.haml
index bfabbde..1288441 100644
--- a/src/app/views/api/images/_image.xml.haml
+++ b/src/app/views/api/images/_image.xml.haml
@@ -5,7 +5,7 @@
%description= image.description
%os= image.os.name
%os_version= image.os.version
- %arch= image.os.arch
+ %arch= image.architecture
%builds{:type => 'xs:list'}
- image.image_builds.each do |bld|
%build{:id => bld.id, :href => api_build_url(bld.id)}
diff --git a/src/app/views/images/_list.html.haml b/src/app/views/images/_list.html.haml
index 635297f..e9a6fc5 100644
--- a/src/app/views/images/_list.html.haml
+++ b/src/app/views/images/_list.html.haml
@@ -28,6 +28,6 @@
%td
= image.os.version.empty? ? "N/A" : image.os.version
%td
- = image.os.arch.empty? ? "N/A" : image.os.arch
+ = image.architecture.blank? ? "N/A" : image.architecture
%td
= Time.at(image.latest_pushed_or_unpushed_build.timestamp.to_f) rescue ''
diff --git a/src/spec/controllers/api/images_controller_spec.rb b/src/spec/controllers/api/images_controller_spec.rb
index 58bc11a..273ee30 100644
--- a/src/spec/controllers/api/images_controller_spec.rb
+++ b/src/spec/controllers/api/images_controller_spec.rb
@@ -40,7 +40,8 @@ describe Api::ImagesController do
:image_builds => [@build],
:build => @build,
:provider_images => [@provider_image, @provider_image.clone],
- :uuid => '94dc260c-5821-11e1-9477-70f395039857'
+ :uuid => '94dc260c-5821-11e1-9477-70f395039857',
+ :architecture => 'x86_64'
)
@provider_type = mock(ProviderType,
:name => 'mock',
--
1.7.6.5
More information about the aeolus-devel
mailing list