Guest User

Untitled

a guest
May 17th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  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
Add Comment
Please, Sign In to add comment