[PATCH conductor 3/3] Changed Event.description column to text

jprovazn at redhat.com jprovazn at redhat.com
Wed Sep 5 14:00:52 UTC 2012


From: Jan Provaznik <jprovazn at redhat.com>

It turned out that sometimes is error message quite long (if a match is not found),
in such case is the message saved into description column.
---
 src/app/models/deployment.rb                               | 4 ++--
 src/app/views/deployments/_history.html.haml               | 2 ++
 src/config/locales/en.yml                                  | 2 +-
 src/db/migrate/20120905133246_event_description_to_text.rb | 9 +++++++++
 4 files changed, 14 insertions(+), 3 deletions(-)
 create mode 100644 src/db/migrate/20120905133246_event_description_to_text.rb

diff --git a/src/app/models/deployment.rb b/src/app/models/deployment.rb
index 63a0262..3a9d160 100644
--- a/src/app/models/deployment.rb
+++ b/src/app/models/deployment.rb
@@ -786,8 +786,8 @@ class Deployment < ActiveRecord::Base
           :source => self,
           :event_time => DateTime.now,
           :status_code => 'deployment_launch_failed',
-          :summary => I18n.t('deployments.errors.launch_failed',
-                             :msg => $!.message)
+          :summary => I18n.t('deployments.errors.launch_failed'),
+          :description => $!.message
         )
         update_attribute(:state, STATE_FAILED)
         cleanup_failed_launch
diff --git a/src/app/views/deployments/_history.html.haml b/src/app/views/deployments/_history.html.haml
index f5dbcec..5f17859 100644
--- a/src/app/views/deployments/_history.html.haml
+++ b/src/app/views/deployments/_history.html.haml
@@ -5,3 +5,5 @@
       - if event.source_type == 'Instance'
         = link_to t('.instance', :name => event.source.name), instance_path(event.source)
       = event.summary
+      - if event.description.present?
+        = ": #{event.description}"
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 19053e7..983fb84 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -411,7 +411,7 @@ en:
       not_valid_deployable_xml: "seems to be not valid Deployable XML: %{msg}"
       match_not_found: "Unable to find a suitable Provider Account to host the Deployment. Check the quota of the Provider Accounts and the status of the Images."
       match_not_found_with_errors: "Match not found: %{errors}"
-      launch_failed: "Failed to launch deployment: %{msg}"
+      launch_failed: "Failed to launch deployment"
     events:
       launch_attempt: "Attempting to launch this deployment on provider account %{account}"
       state_changed: "State changed to %{state}"
diff --git a/src/db/migrate/20120905133246_event_description_to_text.rb b/src/db/migrate/20120905133246_event_description_to_text.rb
new file mode 100644
index 0000000..8cc3232
--- /dev/null
+++ b/src/db/migrate/20120905133246_event_description_to_text.rb
@@ -0,0 +1,9 @@
+class EventDescriptionToText < ActiveRecord::Migration
+  def up
+    change_column :events, :description, :text
+  end
+
+  def down
+    change_column :events, :description, :string
+  end
+end
-- 
1.7.11.4




More information about the aeolus-devel mailing list