[PATCH] BZ 852205 - clarify error message when user tries to delete a provider account with deployments with running instances

tzumainn at redhat.com tzumainn at redhat.com
Fri Sep 7 13:47:40 UTC 2012


From: Tzu-Mainn Chen <tzumainn at redhat.com>

---
 src/app/models/provider_account.rb                 |    5 +++--
 src/config/locales/en.yml                          |    2 +-
 .../step_definitions/provider_account_steps.rb     |    3 ++-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/app/models/provider_account.rb b/src/app/models/provider_account.rb
index f23b286..acc7d64 100644
--- a/src/app/models/provider_account.rb
+++ b/src/app/models/provider_account.rb
@@ -149,8 +149,9 @@ class ProviderAccount < ActiveRecord::Base
       true
     else
       raise Aeolus::Conductor::Base::NotDestroyable,
-        I18n.t('provider_accounts.errors.not_destroyable_instances',
-               :instances => not_destroyable_instances.map{|i| i.name}.join(', '))
+        I18n.t('provider_accounts.errors.not_destroyable_deployments',
+               :deployments => not_destroyable_instances.
+               map{|i| i.deployment.name}.uniq.join(', '))
     end
   end
 
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 250307d..092d5f7 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -1339,7 +1339,7 @@ en:
       populate_hardware_profiles_failed: "Failed to populate hardware_profiles: %{message}"
       populate_realms_failed: "Failed to populate Realms: %{message}"
       could_not_connect: "Could not connect to Provider Account.  Please contact an Administrator."
-      not_destroyable_instances: "Can not destroy following instances: %{instances}"
+      not_destroyable_deployments: "The following Deployments have not been stopped: %{deployments}"
       associated_images: "There are following associated provider images: %{images}. Delete them first."
   provider_priority_groups:
     index:
diff --git a/src/features/step_definitions/provider_account_steps.rb b/src/features/step_definitions/provider_account_steps.rb
index 74ac178..135a4bf 100644
--- a/src/features/step_definitions/provider_account_steps.rb
+++ b/src/features/step_definitions/provider_account_steps.rb
@@ -14,7 +14,8 @@
 #   limitations under the License.
 #
 Given /^the account has an instance associated with it$/ do
-  FactoryGirl.create :instance, :provider_account => @provider_account
+  deployment = Factory.create(:deployment)
+  FactoryGirl.create :instance, :provider_account => @provider_account, :deployment => deployment
 end
 
 Given /^all the account instances are stopped$/ do
-- 
1.7.6.5




More information about the aeolus-devel mailing list