summaryrefslogtreecommitdiffstats
path: root/lib/puppet/rails
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-04 06:44:01 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-04 06:44:01 +0000
commitf4b2e13dfbfa00c40400d979275b6b98bff05f4f (patch)
treecc408a1ce448d65b492d3902988b2f3349b606c5 /lib/puppet/rails
parent098081d88fe17b221bad00c17ccff42324823a7a (diff)
downloadpuppet-f4b2e13dfbfa00c40400d979275b6b98bff05f4f.tar.gz
puppet-f4b2e13dfbfa00c40400d979275b6b98bff05f4f.tar.xz
puppet-f4b2e13dfbfa00c40400d979275b6b98bff05f4f.zip
Fixing #391. Keeping track of times of compile and freshness checks.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2034 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/rails')
-rw-r--r--lib/puppet/rails/database/schema.rb4
-rw-r--r--lib/puppet/rails/host.rb9
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/puppet/rails/database/schema.rb b/lib/puppet/rails/database/schema.rb
index 878d93825..9397916c2 100644
--- a/lib/puppet/rails/database/schema.rb
+++ b/lib/puppet/rails/database/schema.rb
@@ -32,7 +32,9 @@ class Puppet::Rails::Schema
create_table :hosts do |t|
t.column :name, :string, :null => false
t.column :ip, :string
- t.column :connect, :date
+ t.column :last_compile, :date
+ t.column :last_freshcheck, :date
+ t.column :last_report, :date
#Use updated_at to automatically add timestamp on save.
t.column :updated_at, :date
t.column :source_file_id, :integer
diff --git a/lib/puppet/rails/host.rb b/lib/puppet/rails/host.rb
index 0b88afe62..3efdfa9df 100644
--- a/lib/puppet/rails/host.rb
+++ b/lib/puppet/rails/host.rb
@@ -48,6 +48,8 @@ class Puppet::Rails::Host < ActiveRecord::Base
host.setresources(hash[:resources])
+ host.last_compile = Time.now
+
host.save
return host
@@ -56,7 +58,7 @@ class Puppet::Rails::Host < ActiveRecord::Base
def tags=(tags)
tags.each do |tag|
self.tag_with tag
- end
+ end
end
# Return the value of a fact.
@@ -87,6 +89,11 @@ class Puppet::Rails::Host < ActiveRecord::Base
resource.to_rails(self)
end
end
+
+ def update_connect_time
+ self.last_connect = Time.now
+ save
+ end
end
# $Id$