Issue #1886 has been updated by Peter Meier.

Michael Stahnke wrote:
> Moving to 2.7.x as it doesn't look like this was fully fixed at 2.7.3 rc1 
> timeframe.

Sent a new pull request.
----------------------------------------
Feature #1886: Add node cleanup capability
https://projects.puppetlabs.com/issues/1886

Author: micah -
Status: Tests Insufficient
Priority: Normal
Assignee: Daniel Pittman
Category: newfeature
Target version: 2.7.x
Affected Puppet version: 0.25.0
Keywords: communitypatch
Branch: 2.7.x


There really isn't a good mechanism to clean up when a node no longer exits. 
You can remove it from your node definition, but there is a lot of junk hanging 
around that should be cleaned up too. It would be really cool if the ability to 
wipe a node was built into puppetmaster so you could just simply do something 
like:

<pre>
puppetmaster --clean node
puppetmaster --clean node.domain.name
</pre>

and this would clean up everything that puppet can find on that node. The 
things that I can think of that need to get cleaned up are:

1. Signed certificates ($vardir/ssl/ca/signed/node.domain.pem)
2. Cached facts ($vardir/yaml/facts/node.domain.yaml)
3. Cached node stuff ($vardir/yaml/node/node.domain.yaml)
4. Reports ($vardir/reports/node.domain)
5. Stored configs. I found a script on the wiki that takes care of this:
<pre>
#!/usr/bin/env ruby

## Usage: sudo ./kill_node_in_storeconfigs_db.rb <hostname as stored in hosts 
table>

require 'puppet/rails'

Puppet[:config] = "/etc/puppet/puppet.conf"
Puppet.parse_config
pm_conf = Puppet.settings.instance_variable_get(:@values)[:puppetmasterd]

adapter = pm_conf[:dbadapter]
args = {:adapter => adapter, :log_level => pm_conf[:rails_loglevel]}

case adapter
  when "sqlite3":
    args[:dbfile] = pm_conf[:dblocation]
  when "mysql", "postgresql":
    args[:host]     = pm_conf[:dbserver] unless pm_conf[:dbserver].empty?
    args[:username] = pm_conf[:dbuser] unless pm_conf[:dbuser].empty?
    args[:password] = pm_conf[:dbpassword] unless pm_conf[:dbpassword].empty?
    args[:database] = pm_conf[:dbname]
  else
    raise ArgumentError, "Invalid db adapter %s" % adapter
end

ActiveRecord::Base.establish_connection(args)

if @host = Puppet::Rails::Host.find_by_name(ARGV[0].strip)
  print "Killing #{ARGV[0]}..." 
  $stdout.flush
  @host.destroy 
  puts "done."
else
  puts "Can't find host #{ARGV[0]}."
end
</end>

Sure, I can do all this manually, but this is a feature request because its a 
little annoying and you forget all the pieces. 


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs?hl=en.

Reply via email to