From 3ddb164a30a86c331307e575972c7d940bb965f8 Mon Sep 17 00:00:00 2001 From: Frank Sweetser Date: Fri, 18 Jun 2010 15:43:14 -0400 Subject: [PATCH] Delay purging facts and reports on host build --- app/controllers/unattended_controller.rb | 6 ++++++ app/models/host.rb | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/unattended_controller.rb b/app/controllers/unattended_controller.rb index e0fa19a..9e8aeb8 100644 --- a/app/controllers/unattended_controller.rb +++ b/app/controllers/unattended_controller.rb @@ -3,6 +3,7 @@ class UnattendedController < ApplicationController helper :all before_filter :get_host_details, :allowed_to_install? before_filter :handle_ca, :except => [:jumpstart_finish, :preseed_finish] + before_filter :clear_host_records skip_before_filter :require_ssl, :require_login def kickstart @@ -97,4 +98,9 @@ class UnattendedController < ApplicationController render :template => "unattended/#{type}.local" if File.exists?("#{RAILS_ROOT}/app/views/unattended/#{type}.local.rhtml") end + def clear_host_records + @host.clearFacts + @host.clearReports + end + end diff --git a/app/models/host.rb b/app/models/host.rb index e70c1f0..16d2f35 100644 --- a/app/models/host.rb +++ b/app/models/host.rb @@ -291,11 +291,7 @@ class Host < Puppet::Rails::Host # Called by build link in the list # Build is set # The boot link and autosign entry are created - # Any existing puppet certificates are deleted - # Any facts are discarded def setBuild - clearFacts - clearReports #TODO move this stuff to be in the observer, as if the host changes after its being built this might invalidate the current settings return false unless GW::Tftp.create([mac, os.to_s.gsub(" ","-"), arch.name, serial]) self.build = true -- 1.6.6.1