Class: RemasterCommand
- Inherits:
-
Object
- Object
- RemasterCommand
- Defined in:
- lib/commands/remaster.rb
Overview
NK *** TODO move debug out into option
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(argv, env) ⇒ RemasterCommand
constructor
A new instance of RemasterCommand.
Constructor Details
#initialize(argv, env) ⇒ RemasterCommand
Returns a new instance of RemasterCommand.
5 6 7 8 9 |
# File 'lib/commands/remaster.rb', line 5 def initialize(argv, env) @argv = argv @env = env @logger = Log4r::Logger.new("vagrant::command::#{self.class.to_s.downcase}") end |
Class Method Details
.synopsis ⇒ Object
11 12 13 |
# File 'lib/commands/remaster.rb', line 11 def self.synopsis "DOES NOT WORK YET -- Sets up a new puppet master while recycling the SSL keys on a puppetdb" end |
Instance Method Details
#execute ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/commands/remaster.rb', line 15 def execute opt_hash = {} opt_hash[:debug] = false v_opts = OptionParser.new do |opts| opts. = 'Usage: vargrant remaster [-v]' opts.on( "-d", "--debug", "Add debug level to puppet runs" ) do |opt| opt_hash[:debug] = opt end end # Parse the options argv = (v_opts) # return unless argv.length == 0 with_target_vms('puppet') do |machine| @env.ui.info "Destroying puppet master" machine.action(:destroy, :force_confirm_destroy=>true) machine.action(:up) # this is hack to get around a bug in the vagrant # initialization. # this is the issue on REHL: # https://github.com/mitchellh/vagrant/pull/1577 cycle_iface machine, "eth1" @env.ui.info "Bootstrapping puppet master" ssh_cmd machine, "/puppet_configs/scripts/puppet_master_setup.sh puppet.localdev.livefyre.com" # ssh_cmd machine, "sudo puppet agent -t --debug" end with_target_vms('puppetdb') do |machine| @env.ui.info "Cycling puppet db SSL" # NK begin cert regen and jetty cert regen ssh_cmd machine, "/puppet_configs/scripts/client_new_master_migration.sh" ssh_cmd machine, "rm -rf /etc/puppetdb/ssl" # NK This is needed since puppetdb-ssl-setup needs the appropriate certs to run and this is the easiest way to get them back # NK current deprecation warning does not allow me to use '-t' (detailed exitcodes) ssh_cmd machine, "sudo puppet agent --no-daemonize --onetime --noop --debug" ssh_cmd machine, "/usr/sbin/puppetdb-ssl-setup" # NK end certs regen # NK the puppetdb-ssl-setup breaks some init settings, we use puppet to make it right. Also, error_check is true by default...keeping this as an example. ssh_cmd machine, "sudo puppet agent --no-daemonize --onetime --debug", {:error_check => true} end with_target_vms('puppet') do |machine| @env.ui.info "NK *** kicking off puppet agent on master" ssh_cmd machine, "sudo puppet agent -t --debug" end # with_target_vms('puppet') do |machine| # @env.ui.info "Running puppet on puppet master" # ssh_cmd machine, "/puppet_configs/scripts/ensure_puppet_converged -w" # end end |