# File lib/simp/cli/commands/bootstrap.rb, line 299
  def self.ensure_puppet_processes_stopped
    # Kill the connection with puppetdb before killing the puppetserver
    info('Killing connection to puppetdb', 'cyan')
    execute('puppet resource service puppetdb ensure=stopped >& /dev/null')
    execute('pkill -9 -f puppetdb')
    confdir = ::Utils.puppet_info[:config]['confdir']
    routes_yaml = File.join(confdir, 'routes.yaml')
    if File.exists?(routes_yaml)
      backup_dir = File.join(@bootstrap_backup, confdir)
      FileUtils.mkdir_p(backup_dir)
      backup_routes_yaml = File.join(backup_dir, 'routes_yaml')
      FileUtils.cp(routes_yaml, backup_routes_yaml)
      info("Successfully backed up #{routes_yaml} to #{backup_routes_yaml}", 'green')
      FileUtils.rm_f(routes_yaml)
      info("Successfully removed #{routes_yaml}", 'green')
    else
      debug("Did not find #{routes_yaml}, not removing")
    end
    execute('puppet config set --section master storeconfigs false')
    execute('puppet config set --section main storeconfigs false')
    debug("Successfully set storeconfigs=false in #{confdir}/puppet.conf", 'green')

    # Kill all puppet processes and stop specific services
    info('Killing all remaining puppet processes', 'cyan')
    execute('puppet resource service puppetserver ensure=stopped >& /dev/null')
    execute('pkill -9 -f puppet >& /dev/null')
    execute('pkill -f pserver_tmp')  # another bootstrap run

    # Remove the run directory
    rundir = ::Utils.puppet_info[:config]['rundir']
    FileUtils.rm_f(Dir.glob(File.join(rundir,'*')))
    info("Successfully removed #{rundir}/*", 'green')
  end