Dzahn has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/310613

Change subject: replace deprecated puppetstoredconfigclean.rb
......................................................................

replace deprecated puppetstoredconfigclean.rb

Change-Id: I14311c9fa48d5c95512b956e586c1a68525a5628
---
M modules/puppetmaster/files/puppetstoredconfigclean.rb
M modules/puppetmaster/files/wmf-reimage
2 files changed, 3 insertions(+), 92 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/13/310613/1

diff --git a/modules/puppetmaster/files/puppetstoredconfigclean.rb 
b/modules/puppetmaster/files/puppetstoredconfigclean.rb
index f5e2753..dda3cf4 100644
--- a/modules/puppetmaster/files/puppetstoredconfigclean.rb
+++ b/modules/puppetmaster/files/puppetstoredconfigclean.rb
@@ -1,91 +1,2 @@
-#!/usr/bin/env ruby
-
-# Script to clean up stored configs for (a) given host(s)
-#
-# Credits:
-# Script was taken from 
http://reductivelabs.com/trac/puppet/attachment/wiki/UsingStoredConfiguration/kill_node_in_storedconfigs_db.rb
 (link no longer valid),
-# which haven been initially posted by James Turnbull
-# duritong adapted and improved the script a bit.
-
-require 'getoptlong'
-config = '/etc/puppet/puppet.conf'
-
-def printusage(error_code)
-  puts "Usage: #{$0} [ list of hostnames as stored in hosts table ]"
-  puts "\n Options:"
-  puts "--config <puppet config file>"
-  exit(error_code)
-end
-
-
-      opts = GetoptLong.new(
-
-    [ "--config",     "-c",   GetoptLong::REQUIRED_ARGUMENT ],
-    [ "--help",        "-h",   GetoptLong::NO_ARGUMENT ],
-    [ "--usage",       "-u",   GetoptLong::NO_ARGUMENT ],
-
-    [ "--version",     "-v",   GetoptLong::NO_ARGUMENT ]
-)
-
-begin
-  opts.each do |opt, arg|
-    case opt
-    when "--config"
-      config = arg
-
-    when "--help"
-      printusage(0)
-
-    when "--usage"
-      printusage(0)
-
-    when "--version"
-      puts "#{Puppet.version}"
-      exit
-    end
-  end
-rescue GetoptLong::InvalidOption => detail
-  $stderr.puts "Try '#{$0} --help'"
-  exit(1)
-end
-
-printusage(1) unless ARGV.size > 0
-
-require 'puppet/rails'
-Puppet[:config] = config
-Puppet.parse_config
-pm_conf = Puppet.settings.instance_variable_get(:@values)[:master]
-
-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].to_s.empty?
-  args[:username] = pm_conf[:dbuser] unless pm_conf[:dbuser].to_s.empty?
-  args[:password] = pm_conf[:dbpassword] unless 
pm_conf[:dbpassword].to_s.empty?
-  args[:database] = pm_conf[:dbname] unless pm_conf[:dbname].to_s.empty?
-  args[:port]     = pm_conf[:dbport] unless pm_conf[:dbport].to_s.empty?
-  socket          = pm_conf[:dbsocket]
-  args[:socket]   = socket unless socket.to_s.empty?
-else
-  raise ArgumentError, "Invalid db adapter #{adapter}"
-end
-
-args[:database] = "puppet" unless not args[:database].to_s.empty?
-
-ActiveRecord::Base.establish_connection(args)
-
-ARGV.each { |hostname|
-  if @host = Puppet::Rails::Host.find_by_name(hostname.strip)
-    print "Killing #{hostname}..."
-    $stdout.flush
-    @host.destroy
-    puts "done."
-  else
-    puts "Can't find host #{hostname}."
-  end
-}
+puts "This script is deprecated. Please use 'puppet node clean <fqdn>' 
instead."
 exit 0
diff --git a/modules/puppetmaster/files/wmf-reimage 
b/modules/puppetmaster/files/wmf-reimage
index 25ba300..011ebee 100755
--- a/modules/puppetmaster/files/wmf-reimage
+++ b/modules/puppetmaster/files/wmf-reimage
@@ -23,8 +23,8 @@
         log "Maybe you need to use the -n switch?"
         exit 1
     fi
-    log "cleaning puppet facts cache for ${nodename}"
-    /usr/local/sbin/puppetstoredconfigclean.rb ${nodename}
+    log "revoking puppet cert and cleaning puppet facts cache for ${nodename}"
+    puppet node clean ${nodename}
 }
 
 function __salt_key {

-- 
To view, visit https://gerrit.wikimedia.org/r/310613
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I14311c9fa48d5c95512b956e586c1a68525a5628
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Dzahn <dz...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to