summaryrefslogtreecommitdiffstats
path: root/lib/puppet/rails
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-05-15 20:19:03 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-05-15 20:19:03 +0000
commita0bcf5a355569633de420e109bce493cc8808a26 (patch)
treeabf3d0c64bac724862405032ee213fc4403deaa9 /lib/puppet/rails
parent122e2bc780e2b135c8d95ce28be74eac5a6e3fd2 (diff)
downloadpuppet-a0bcf5a355569633de420e109bce493cc8808a26.tar.gz
puppet-a0bcf5a355569633de420e109bce493cc8808a26.tar.xz
puppet-a0bcf5a355569633de420e109bce493cc8808a26.zip
Adding code to try for the rails gem if the library cannot be found normally, and adding some protections in case there are problems
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1198 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/rails')
-rw-r--r--lib/puppet/rails/database.rb4
-rw-r--r--lib/puppet/rails/host.rb5
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/puppet/rails/database.rb b/lib/puppet/rails/database.rb
index e0a91cb7a..caf87cbb8 100644
--- a/lib/puppet/rails/database.rb
+++ b/lib/puppet/rails/database.rb
@@ -2,7 +2,9 @@ class Puppet::Rails::Database < ActiveRecord::Migration
require 'sqlite3'
def self.up
- ActiveRecord::Migration.verbose = false
+ if ActiveRecord::Migration.respond_to?(:verbose)
+ ActiveRecord::Migration.verbose = false
+ end
create_table :rails_objects do |table|
table.column :name, :string, :null => false
diff --git a/lib/puppet/rails/host.rb b/lib/puppet/rails/host.rb
index ace906117..77123c871 100644
--- a/lib/puppet/rails/host.rb
+++ b/lib/puppet/rails/host.rb
@@ -2,7 +2,6 @@ require 'puppet/rails/rails_object'
#RailsObject = Puppet::Rails::RailsObject
class Puppet::Rails::Host < ActiveRecord::Base
- Host = self
serialize :facts, Hash
serialize :classes, Array
@@ -10,7 +9,7 @@ class Puppet::Rails::Host < ActiveRecord::Base
# If the host already exists, get rid of its objects
def self.clean(host)
- if obj = Host.find_by_name(host)
+ if obj = self.find_by_name(host)
obj.rails_objects.clear
return obj
else
@@ -47,7 +46,7 @@ class Puppet::Rails::Host < ActiveRecord::Base
end
host.addobjects(objects)
else
- host = Host.new(hostargs) do |hostobj|
+ host = self.new(hostargs) do |hostobj|
hostobj.addobjects(objects)
end
end