[PATCH conductor] fixed bug in session_entites migration that was hit when there was invalid db data
Matt Wagner
matt.wagner at redhat.com
Fri Jun 8 16:09:39 UTC 2012
On Fri, Jun 08, 2012 at 11:39:13AM -0400, Scott Seago wrote:
> If a user attempts to log in with the session_entities fix but
> prior to running the migration, an invalid session_entity is
> created (with '0' session_id), and then the migration would
> fail due to improper handling of exceptions.
> ---
> ...06200000_fix_session_id_for_session_entities.rb | 10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/db/migrate/20120606200000_fix_session_id_for_session_entities.rb b/src/db/migrate/20120606200000_fix_session_id_for_session_entities.rb
> index 908edae..5d8a22a 100644
> --- a/src/db/migrate/20120606200000_fix_session_id_for_session_entities.rb
> +++ b/src/db/migrate/20120606200000_fix_session_id_for_session_entities.rb
> @@ -19,12 +19,12 @@ class FixSessionIdForSessionEntities < ActiveRecord::Migration
> add_column :session_entities, :session_id, :string
> SessionEntity.reset_column_information
> SessionEntity.all.each do |se|
> - session = ActiveRecord::SessionStore::Session.find(se.session_db_id)
> - if session
> + begin
> + session = ActiveRecord::SessionStore::Session.find(se.session_db_id)
> se.session_id = session.session_id
> se.save!
> - else
> - se.delete!
> + rescue
> + se.destroy
> end
> end
> remove_column :session_entities, :session_db_id
> @@ -40,7 +40,7 @@ class FixSessionIdForSessionEntities < ActiveRecord::Migration
> se.session_db_id = session.id
> se.save!
> else
> - se.delete!
> + se.destroy
> end
> end
> remove_column :session_entities, :session_id
> --
> 1.7.6.5
ACK. This is exactly the fix we discussed that got things back up and
running for me.
-- Matt
More information about the aeolus-devel
mailing list