Exemplo n.º 1
0
 def wrapper(*args, **kwargs):
     result = func(*args, **kwargs)
     if settings.STORE_ASTUTE_YAML:
         environment = get_current_env(args)
         if environment:
             store_astute_yaml(environment)
         else:
             logger.warning("Can't download astute.yaml: " "Unexpected class is decorated.")
     return result
Exemplo n.º 2
0
 def wrapper(*args, **kwargs):
     result = func(*args, **kwargs)
     if settings.STORE_ASTUTE_YAML:
         environment = get_current_env(args)
         if environment:
             store_astute_yaml(environment)
         else:
             logger.warning("Can't download astute.yaml: "
                            "Unexpected class is decorated.")
     return result
Exemplo n.º 3
0
 def wrapper(*args, **kwagrs):
     logger.info("\n" + "<" * 5 + "#" * 30 + "[ {} ]"
                 .format(func.__name__) + "#" * 30 + ">" * 5 + "\n{}"
                 .format(func.__doc__))
     try:
         result = func(*args, **kwagrs)
         if settings.STORE_ASTUTE_YAML:
             store_astute_yaml(args[0].env, func.__name__)
         return result
     except SkipTest:
         raise SkipTest()
     except Exception as test_exception:
         exc_trace = sys.exc_traceback
         name = 'error_%s' % func.__name__
         description = "Failed in method '%s'." % func.__name__
         if args[0].env is not None:
             try:
                 create_diagnostic_snapshot(args[0].env,
                                            "fail", name)
             except:
                 logger.error("Fetching of diagnostic snapshot failed: {0}".
                              format(traceback.format_exc()))
                 try:
                     admin_remote = args[0].env.get_admin_remote()
                     pull_out_logs_via_ssh(admin_remote, name)
                 except:
                     logger.error("Fetching of raw logs failed: {0}".
                                  format(traceback.format_exc()))
             finally:
                 logger.debug(args)
                 try:
                     args[0].env.make_snapshot(snapshot_name=name[-50:],
                                               description=description,
                                               is_make=True)
                 except:
                     logger.error("Error making the environment snapshot:"
                                  " {0}".format(traceback.format_exc()))
         raise test_exception, None, exc_trace
Exemplo n.º 4
0
 def wrapper(*args, **kwargs):
     result = func(*args, **kwargs)
     if settings.STORE_ASTUTE_YAML:
         store_astute_yaml(args[0].env)
     return result
Exemplo n.º 5
0
 def wrapper(*args, **kwargs):
     result = func(*args, **kwargs)
     if settings.STORE_ASTUTE_YAML:
         store_astute_yaml(args[0].env)
     return result