daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest May 17th, 2018 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## kill_node_in_storeconfigs_db.rb
  2. Usage: sudo ./kill_node_in_storeconfigs_db.rb <hostname as stored in hosts table>
  3. #!/usr/bin/env ruby
  4.  
  5. require 'puppet/rails'
  6.  
  7. Puppet[:config] = "/etc/puppet/puppet.conf"
  8. Puppet.parse_config
  9. # This should work but Puppet[:dbadapter] is the default sqlite3 no matter what.
  10. Puppet::Rails.connect  
  11.  
  12. if @host = Puppet::Rails::Host.find_by_name(ARGV[0].strip)
  13.   print "Killing #{ARGV[0]}..."
  14.   $stdout.flush
  15.   @host.destroy
  16.   puts "done."
  17. else
  18.   puts "Can't find host #{ARGV[0]}."
  19. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top