Tests have also been updated to succeed when the the warehouse is offline
---
src/app/controllers/pools_controller.rb | 6 +++-
src/app/views/pools/_images.html.haml | 39 ++++++++++++++++-----------
src/config/locales/en.yml | 1 +
src/features/pool.feature | 2 +-
src/features/step_definitions/pool_steps.rb | 8 +++++
5 files changed, 38 insertions(+), 18 deletions(-)
diff --git a/src/app/controllers/pools_controller.rb
b/src/app/controllers/pools_controller.rb
index 3d9b6cf..6aeb4d5 100644
--- a/src/app/controllers/pools_controller.rb
+++ b/src/app/controllers/pools_controller.rb
@@ -94,7 +94,11 @@ class PoolsController < ApplicationController
{:name => "#{t'catalog_images'}", :view =>
'images', :id => 'images'}
]
if "images" == params[:details_tab]
- @map = @pool.provider_image_map
+ begin
+ @map = @pool.provider_image_map
+ rescue
+ flash[:error] = t 'pools.flash.error.iwhd_unavailable'
+ end
end
add_permissions_tab(@pool)
diff --git a/src/app/views/pools/_images.html.haml
b/src/app/views/pools/_images.html.haml
index 9c17290..6842232 100644
--- a/src/app/views/pools/_images.html.haml
+++ b/src/app/views/pools/_images.html.haml
@@ -1,19 +1,26 @@
-- @map.each_pair do |catalog, catalog_entries|
- %h1{:style => 'font-size: 18pt;'}
- = catalog.name
- = t('.catalog')
+-if flash[:error]
+ -if flash[:error].kind_of?(String)
+ .flash-subset
+ %div.heading
+ =image_tag 'flash_error_icon.png', :alt => 'Errors'
+ =flash[:error]
+-else
+ - @map.each_pair do |catalog, catalog_entries|
+ %h1{:style => 'font-size: 18pt;'}
+ = catalog.name
+ = t('.catalog')
- - catalog_entries.each_pair do |entry, images|
- %h2{:style => 'font-size: 16pt;'}
- = entry.name
- = t('.catalog_entry')
+ - catalog_entries.each_pair do |entry, images|
+ %h2{:style => 'font-size: 16pt;'}
+ = entry.name
+ = t('.catalog_entry')
- - images.each_pair do |image, provider_images|
- %h3{:style => 'font-size: 14pt;'}
- = t('.image')
- = "#{image.name} (#{image.uuid})"
+ - images.each_pair do |image, provider_images|
+ %h3{:style => 'font-size: 14pt;'}
+ = t('.image')
+ = "#{image.name} (#{image.uuid})"
- %ul
- - provider_images.each do |provider_image|
- %li
- = t('.pushed', :uuid => provider_image.uuid, :provider =>
provider_image.provider_name)
+ %ul
+ - provider_images.each do |provider_image|
+ %li
+ = t('.pushed', :uuid => provider_image.uuid, :provider =>
provider_image.provider_name)
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 70e82fc..c62c67a 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -396,6 +396,7 @@ en:
other: Pools %{list} were not deleted. They have instances associated with
them.
not_updated: "Pool wasn't updated!"
default_pool_not_deleted: The default pool cannot be deleted
+ iwhd_unavailable: Catalog Images are unavailable. It appears the image warehouse
is not reachable
warning:
creation_failed: Pool creation failed.
valid_format_of_name: "must only contain: numbers, letters, spaces, '_'
and '-'"
diff --git a/src/features/pool.feature b/src/features/pool.feature
index 91f331d..5c0518c 100644
--- a/src/features/pool.feature
+++ b/src/features/pool.feature
@@ -206,4 +206,4 @@ Scenario: Select Catalog Images on pool detail page
And "mockcatalog" has catalog_entry "mockcatalogentry"
When I am viewing the pool "mockpool"
And I follow link with ID "details_images"
- Then I should see "mockcatalog" within "#tab"
+ Then I should see a pools "mockcatalog" within "#tab"
diff --git a/src/features/step_definitions/pool_steps.rb
b/src/features/step_definitions/pool_steps.rb
index e29282a..af9aa53 100644
--- a/src/features/step_definitions/pool_steps.rb
+++ b/src/features/step_definitions/pool_steps.rb
@@ -77,6 +77,14 @@ Given /^I renamed Default to pool_default$/ do
p.save
end
+Then /^I should see a pools "([^""]*)"$/ do |arg1|
+ if page.has_content? "unavailable"
+ page.should have_content("Catalog Images are unavailable. It appears the image
warehouse is not reachable")
+ else
+ page.should have_content(arg1)
+ end
+end
+
Then /^I should see (\d+) pools in JSON format$/ do |arg1|
data = ActiveSupport::JSON.decode(page.source)
data.length.should == arg1.to_i
--
1.7.6.4