[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.7-1-98-gf19c0e5

James Turnbull james at lovedthanlost.net
Wed Apr 8 21:48:07 UTC 2009


The following commit has been merged in the master branch:
commit f0ac3aef53a08e271a5c243f17785cdb58f1f5ef
Author: James Turnbull <james at lovedthanlost.net>
Date:   Thu Feb 12 08:20:43 2009 +1100

    Fixed #1959 - Added column protection for environment schema migration

diff --git a/CHANGELOG b/CHANGELOG
index 4294477..9da1919 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 0.24.8
+    Fixed #1959 - Added column protection for environment schema migration
+
     Fixing #1869 - autoloaded files should never leak exceptions
 
     Fixing #1543 - Nagios parse errors no longer kill Puppet
diff --git a/lib/puppet/rails/database/003_add_environment_to_host.rb b/lib/puppet/rails/database/003_add_environment_to_host.rb
index 4593a06..3ed10e9 100644
--- a/lib/puppet/rails/database/003_add_environment_to_host.rb
+++ b/lib/puppet/rails/database/003_add_environment_to_host.rb
@@ -1,9 +1,13 @@
 class AddEnvironmentToHost < ActiveRecord::Migration
     def self.up
-        add_column :hosts, :environment, :string
+        unless ActiveRecord::Base.connection.columns(:hosts).collect {|c| c.name}.include?("environment")
+            add_column :hosts, :environment, :string
+        end
     end
     
     def self.down
-        remove_column :hosts, :environment
+        if ActiveRecord::Base.connection.columns(:hosts).collect {|c| c.name}.include?("environment")
+            remove_column :hosts, :environment
+        end
     end
 end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list