[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

Thom May thom at joost.com
Fri Jan 23 14:21:46 UTC 2009


The following commit has been merged in the master branch:
commit 965c08d8c053996779a6f94e1ea5c3c1863907cd
Author: Thom May <thom at clearairturbulence.org>
Date:   Tue Sep 2 17:59:59 2008 -0400

    Slight denormalisation to store a host's environment as a first class
    object in the database
    Fixes: #1392

diff --git a/lib/puppet/rails/database/002_add_environment_to_host.rb b/lib/puppet/rails/database/002_add_environment_to_host.rb
new file mode 100644
index 0000000..4593a06
--- /dev/null
+++ b/lib/puppet/rails/database/002_add_environment_to_host.rb
@@ -0,0 +1,9 @@
+class AddEnvironmentToHost < ActiveRecord::Migration
+    def self.up
+        add_column :hosts, :environment, :string
+    end
+    
+    def self.down
+        remove_column :hosts, :environment
+    end
+end
diff --git a/lib/puppet/rails/database/schema.rb b/lib/puppet/rails/database/schema.rb
index f3ad2c1..246bec4 100644
--- a/lib/puppet/rails/database/schema.rb
+++ b/lib/puppet/rails/database/schema.rb
@@ -54,6 +54,7 @@ class Puppet::Rails::Schema
                 create_table :hosts do |t|
                     t.column :name, :string, :null => false
                     t.column :ip, :string
+                    t.column :environment, :string
                     t.column :last_compile, :datetime
                     t.column :last_freshcheck, :datetime
                     t.column :last_report, :datetime
diff --git a/lib/puppet/rails/host.rb b/lib/puppet/rails/host.rb
index 626edaa..187dc65 100644
--- a/lib/puppet/rails/host.rb
+++ b/lib/puppet/rails/host.rb
@@ -43,6 +43,10 @@ class Puppet::Rails::Host < ActiveRecord::Base
                 host.ip = ip
             end
 
+            if env = node.environment
+                host.environment = env
+            end
+
             # Store the facts into the database.
             host.setfacts node.parameters
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list