diff options
-rw-r--r-- | lib/puppet/rails.rb | 4 | ||||
-rw-r--r-- | lib/puppet/rails/fact_value.rb | 4 | ||||
-rw-r--r-- | lib/puppet/rails/host.rb | 3 | ||||
-rw-r--r-- | lib/puppet/rails/param_value.rb | 4 | ||||
-rw-r--r-- | lib/puppet/rails/resource_tag.rb | 4 | ||||
-rw-r--r-- | lib/puppet/rails/source_file.rb | 5 |
6 files changed, 21 insertions, 3 deletions
diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb index a1192bf20..a021c773a 100644 --- a/lib/puppet/rails.rb +++ b/lib/puppet/rails.rb @@ -91,6 +91,10 @@ module Puppet::Rails raise Puppet::Error, "Could not find Puppet::Rails database dir" end + unless ActiveRecord::Base.connection.tables.include?("resources") + raise Puppet::Error, "Database has problems, can't migrate." + end + Puppet.notice "Migrating" begin diff --git a/lib/puppet/rails/fact_value.rb b/lib/puppet/rails/fact_value.rb index 0eb70be72..b53591d7e 100644 --- a/lib/puppet/rails/fact_value.rb +++ b/lib/puppet/rails/fact_value.rb @@ -1,6 +1,10 @@ class Puppet::Rails::FactValue < ActiveRecord::Base belongs_to :fact_name belongs_to :host + + def to_label + "#{self.fact_name.name}" + end end # $Id: fact_value.rb 1952 2006-12-19 05:47:57Z luke $ diff --git a/lib/puppet/rails/host.rb b/lib/puppet/rails/host.rb index 72898fd97..626edaa88 100644 --- a/lib/puppet/rails/host.rb +++ b/lib/puppet/rails/host.rb @@ -11,8 +11,7 @@ class Puppet::Rails::Host < ActiveRecord::Base has_many :fact_values, :dependent => :destroy has_many :fact_names, :through => :fact_values - belongs_to :puppet_classes - has_many :source_files + belongs_to :source_file has_many :resources, :include => :param_values, :dependent => :destroy diff --git a/lib/puppet/rails/param_value.rb b/lib/puppet/rails/param_value.rb index 02c29c540..fc00a43d4 100644 --- a/lib/puppet/rails/param_value.rb +++ b/lib/puppet/rails/param_value.rb @@ -20,5 +20,9 @@ class Puppet::Rails::ParamValue < ActiveRecord::Base self[:value] = val end end + + def to_label + "#{self.param_name.name}" + end end diff --git a/lib/puppet/rails/resource_tag.rb b/lib/puppet/rails/resource_tag.rb index d06711877..f9694e082 100644 --- a/lib/puppet/rails/resource_tag.rb +++ b/lib/puppet/rails/resource_tag.rb @@ -1,4 +1,8 @@ class Puppet::Rails::ResourceTag < ActiveRecord::Base belongs_to :puppet_tag belongs_to :resource + + def to_label + "#{self.puppet_tag.name}" + end end diff --git a/lib/puppet/rails/source_file.rb b/lib/puppet/rails/source_file.rb index 51d1b1fb5..3ccf87ac6 100644 --- a/lib/puppet/rails/source_file.rb +++ b/lib/puppet/rails/source_file.rb @@ -1,5 +1,8 @@ class Puppet::Rails::SourceFile < ActiveRecord::Base has_one :host - has_one :puppet_class has_one :resource + + def to_label + "#{self.filename}" + end end |