]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Don't attempt to report if there's no job_id
authorZack Cerza <zack@cerza.org>
Thu, 10 Oct 2013 19:17:51 +0000 (14:17 -0500)
committerZack Cerza <zack@cerza.org>
Fri, 11 Oct 2013 00:09:35 +0000 (19:09 -0500)
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/report.py

index c37e265e95c7e2651dfff4e9bf2e7a3dc3138faa..6c662819f79767f51c113efdd7befe50bfae90df 100644 (file)
@@ -348,6 +348,7 @@ def try_push_job_info(job_config, extra_info=None):
     Wrap push_job_info, gracefully doing nothing if:
         A RequestFailedError is raised
         config.results_server is not set
+        config['job_id'] is not present or is None
 
     :param job_config: The ctx.config object to push
     :param extra_info: Optional second dict to push
@@ -355,20 +356,24 @@ def try_push_job_info(job_config, extra_info=None):
     if not config.results_server:
         msg = "No results_server set in {yaml}; not attempting to push results"
         log.debug(msg.format(yaml=config.teuthology_yaml))
-    else:
-        run_name = job_config['name']
-        job_id = job_config['job_id']
+        return
+    elif job_config.get('job_id') is None:
+        log.debug('No job_id found; not reporting results')
+        return
 
-        if extra_info is not None:
-            job_info = extra_info.copy()
-            job_info.update(job_config)
-        else:
-            job_info = job_config
+    run_name = job_config['name']
+    job_id = job_config['job_id']
 
-        try:
-            log.info("Pushing job info to %s", config.results_server)
-            create_run(run_name)
-            push_job_info(run_name, job_id, job_info)
-        except RequestFailedError:
-            log.exception("Could not report results to %s" %
-                          config.results_server)
+    if extra_info is not None:
+        job_info = extra_info.copy()
+        job_info.update(job_config)
+    else:
+        job_info = job_config
+
+    try:
+        log.info("Pushing job info to %s", config.results_server)
+        create_run(run_name)
+        push_job_info(run_name, job_id, job_info)
+    except RequestFailedError:
+        log.exception("Could not report results to %s" %
+                      config.results_server)