示例#1
0
 def save_mysql(verbosity=1):
   # The output of mysqldump needs to merge many lines at a time
   # for performance reasons (merging lines is at most 10 times
   # faster, so this produce somewhat not nice to read sql
   command = 'mysqldump %s > %s' % (getMySQLArguments(), dump_sql_path,)
   if verbosity:
     _print('Dumping MySQL database with %s ...' % command)
   subprocess.check_call(command, shell=True)
示例#2
0
 def save_mysql(verbosity=1):
   # The output of mysqldump needs to merge many lines at a time
   # for performance reasons (merging lines is at most 10 times
   # faster, so this produce somewhat not nice to read sql
   command = 'mysqldump %s > %s' % (getMySQLArguments(), dump_sql_path,)
   if verbosity:
     _print('Dumping MySQL database with %s ...' % command)
   subprocess.check_call(command, shell=True)
示例#3
0
 def save_mysql(verbosity=1):
   # The output of mysqldump needs to merge many lines at a time
   # for performance reasons (merging lines is at most 10 times
   # faster, so this produce somewhat not nice to read sql
   command = 'mysqldump %s > %s' % (getMySQLArguments(), os.path.abspath('dump.sql'),)
   if verbosity:
     _print('Dumping MySQL database with %s...' % command)
   os.system(command)
示例#4
0
 def save_mysql(verbosity=1):
   # The output of mysqldump needs to merge many lines at a time
   # for performance reasons (merging lines is at most 10 times
   # faster, so this produce somewhat not nice to read sql
   if os.path.exists(dump_sql_path):
     _print("About to overwrite mysqldump at %s (press Ctrl+C to abort)" %
            dump_sql_path)
     time.sleep(5)
   command = 'mysqldump %s > %s' % (getMySQLArguments(), dump_sql_path,)
   if verbosity:
     _print('Dumping MySQL database with %s ...' % command)
   subprocess.check_call(command, shell=True)
示例#5
0
dump_sql_path = os.path.join(instance_home, 'dump.sql')
if save_mysql:
  def save_mysql(verbosity=1):
    # The output of mysqldump needs to merge many lines at a time
    # for performance reasons (merging lines is at most 10 times
    # faster, so this produce somewhat not nice to read sql
    command = 'mysqldump %s > %s' % (getMySQLArguments(), dump_sql_path,)
    if verbosity:
      _print('Dumping MySQL database with %s ...' % command)
    subprocess.check_call(command, shell=True)

if load:
  if save_mysql:
    if os.path.exists(dump_sql_path):
      command = "mysql %s < %s" % (getMySQLArguments(), dump_sql_path)
      _print("Restoring MySQL database with %s ... " % command)
      _start = time.time()
      subprocess.check_call(command, shell=True)
      _print('done (%.3fs)\n' % (time.time() - _start))
    else:
      _print("Could not find MySQL dump (%r), will recreate catalog ... " % dump_sql_path)
      os.environ['erp5_tests_recreate_catalog'] = '1'
  _print("Restoring static files ... ")
else:
  if save and not (neo_storage or zeo_client) and os.path.exists(data_fs_path):
    _print("About to remove existing Data.fs %s (press Ctrl+C to abort)" % data_fs_path)
    time.sleep(5)
    os.remove(data_fs_path)

  # Whether passing --save or not passing both --load and --save, the catalog
示例#6
0
    ret = os.system(command)
    assert not ret

_print("Cleaning static files ... ")
for static_dir in static_dir_list:
  static_dir = os.path.join(instance_home, static_dir)
  if os.path.islink(static_dir):
    os.remove(static_dir)
  elif os.path.exists(static_dir):
    shutil.rmtree(static_dir)

if load:
  if save_mysql:
    if os.path.exists(dump_sql_path):
      _print("Restoring MySQL database ... ")
      ret = os.system("mysql %s < %s" % (getMySQLArguments(), dump_sql_path))
      assert not ret
    else:
      _print("Could not find MySQL dump (%r), will recreate catalog ... " % dump_sql_path)
      os.environ['erp5_tests_recreate_catalog'] = '1'
  _print("Restoring static files ... ")
  live_instance_path = os.environ.get('live_instance_path')
  for dir in static_dir_list:
    full_path = os.path.join(instance_home, dir)
    if live_instance_path:
      backup_path = os.path.join(live_instance_path, dir)
    else:
      backup_path = full_path + '.bak'
    if os.path.exists(backup_path):
      if not save or WIN:
        shutil.copytree(backup_path, full_path, symlinks=True)
示例#7
0
    if verbosity:
      _print('Dumping MySQL database with %s ...' % command)
    subprocess.check_call(command, shell=True)

_print("Cleaning static files ... ")
for static_dir in static_dir_list:
  static_dir = os.path.join(instance_home, static_dir)
  if os.path.islink(static_dir):
    os.remove(static_dir)
  elif os.path.exists(static_dir):
    shutil.rmtree(static_dir)

if load:
  if save_mysql:
    if os.path.exists(dump_sql_path):
      command = "mysql %s < %s" % (getMySQLArguments(), dump_sql_path)
      _print("Restoring MySQL database with %s ... " % command)
      subprocess.check_call(command, shell=True)
    else:
      _print("Could not find MySQL dump (%r), will recreate catalog ... " % dump_sql_path)
      os.environ['erp5_tests_recreate_catalog'] = '1'
  _print("Restoring static files ... ")
  live_instance_path = os.environ.get('live_instance_path')
  for dir in static_dir_list:
    full_path = os.path.join(instance_home, dir)
    if live_instance_path:
      backup_path = os.path.join(live_instance_path, dir)
    else:
      backup_path = full_path + '.bak'
    if os.path.exists(backup_path):
      if not save or WIN: