There is a script ext/puppetstoredconfigclean.rb, but it just calls activerecord's destroy method on host objects, not clean. So unless someone has custom scripts somewhere I doubt anyone's using that clean method. I acked through the codebase pretty thoroughly for the methods I deleted, but I could be missing something. Matt
On Tue, Sep 21, 2010 at 2:50 PM, Luke Kanies <[email protected]> wrote: > I bet that self.clean is used by some of the scripts people use to clean the > database. One of them might be in ext/, but there's a node-clean or > something similar out there somewhere. > > On Sep 21, 2010, at 2:45 PM, Matt Robinson wrote: > >> def self.clean – became orphaned in commit >> 28cee40689440388994a4768bd301ae32c8ecc05 >> >> def self.store – became orphaned in commit >> 863c50b1273a7fa48d74fb74948938214b45967c >> >> def fact – was added as a helper method for unit tests in commit >> 9f4870637ce57d548d23c0b3330200014327c268. The test file that used this >> method was removed in commit 93246c0c70796a606fc8c05b51e1feb09c94e377 >> >> def update_connect_time – Not sure when this was ever used. >> >> I also ran a client master storeconfigs run a few times and didn’t see >> any problems, so I’m pretty sure deleting these methods is safe. >> >> Signed-off-by: Matt Robinson <[email protected]> >> --- >> lib/puppet/rails/host.rb | 72 >> ---------------------------------------------- >> 1 files changed, 0 insertions(+), 72 deletions(-) >> >> diff --git a/lib/puppet/rails/host.rb b/lib/puppet/rails/host.rb >> index 986cebd..b9dea2a 100644 >> --- a/lib/puppet/rails/host.rb >> +++ b/lib/puppet/rails/host.rb >> @@ -16,16 +16,6 @@ class Puppet::Rails::Host < ActiveRecord::Base >> belongs_to :source_file >> has_many :resources, :dependent => :destroy, :class_name => >> "Puppet::Rails::Resource" >> >> - # If the host already exists, get rid of its objects >> - def self.clean(host) >> - if obj = self.find_by_name(host) >> - obj.rails_objects.clear >> - return obj >> - else >> - return nil >> - end >> - end >> - >> def self.from_puppet(node) >> host = find_by_name(node.name) || new(:name => node.name) >> >> @@ -38,63 +28,6 @@ class Puppet::Rails::Host < ActiveRecord::Base >> host >> end >> >> - # Store our host in the database. >> - def self.store(node, resources) >> - args = {} >> - >> - host = nil >> - railsmark "Stored node" do >> - transaction do >> - #unless host = find_by_name(name) >> - >> - debug_benchmark("Searched for host")do >> - unless host = find_by_name(node.name) >> - host = new(:name => node.name) >> - end >> - end >> - if ip = node.parameters["ipaddress"] >> - host.ip = ip >> - end >> - >> - if env = node.environment >> - host.environment = env >> - end >> - >> - # Store the facts into the database. >> - host.merge_facts(node.parameters) >> - >> - debug_benchmark("Handled resources") { >> - host.merge_resources(resources) >> - } >> - >> - host.last_compile = Time.now >> - >> - debug_benchmark("Saved host") { >> - host.save >> - } >> - end >> - >> - end >> - >> - # This only runs if time debugging is enabled. >> - write_benchmarks >> - >> - host >> - end >> - >> - # Return the value of a fact. >> - def fact(name) >> - >> - if fv = self.fact_values.find( >> - :all, :include => :fact_name, >> - >> - :conditions => "fact_names.name = '#{name}'") >> - return fv >> - else >> - return nil >> - end >> - end >> - >> # returns a hash of fact_names.name => [ fact_values ] for this host. >> # Note that 'fact_values' is actually a list of the value instances, not >> # just actual values. >> @@ -305,11 +238,6 @@ class Puppet::Rails::Host < ActiveRecord::Base >> end >> end >> >> - def update_connect_time >> - self.last_connect = Time.now >> - save >> - end >> - >> def to_puppet >> node = Puppet::Node.new(self.name) >> {"ip" => "ipaddress", "environment" => "environment"}.each do |myparam, >> itsparam| >> -- >> 1.7.1 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Developers" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/puppet-dev?hl=en. >> > > > -- > I am a kind of paranoiac in reverse. I suspect people of plotting > to make me happy. --J. D. Salinger > --------------------------------------------------------------------- > Luke Kanies -|- http://puppetlabs.com -|- +1(615)594-8199 > > > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/puppet-dev?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
