summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClark Laughlin <clark.laughlin@linaro.org>2015-05-28 10:40:00 -0400
committerClark Laughlin <clark.laughlin@linaro.org>2015-05-28 10:40:00 -0400
commit71b031e33051a99c861044dc4f3d574cba3d46be (patch)
tree6b27db6d7d8843bedf441c14512286f9914432a0
parent684c6e90c65cc70c885d5a029f8e523a7bb301a7 (diff)
bug fix to check for existance of keys before using
-rw-r--r--tempest-pull/app/app.py9
-rw-r--r--tempest-pull/app/bundle.py10
2 files changed, 12 insertions, 7 deletions
diff --git a/tempest-pull/app/app.py b/tempest-pull/app/app.py
index ed455ed..d23cc1a 100644
--- a/tempest-pull/app/app.py
+++ b/tempest-pull/app/app.py
@@ -42,10 +42,13 @@ def run(config, print_config):
metadata = bundle.expand(config["WHITELIST"], config["LOGS_ROOT"])
- database = Neo4JDatabase(config["NEO4J_ENDPOINT"])
- database.store_bundle(bundle)
+ if metadata is None:
+ print "Invalid / incomplete bundle - skipping"
+ else:
+ database = Neo4JDatabase(config["NEO4J_ENDPOINT"])
+ database.store_bundle(bundle)
+ store.write_bundle_receipt(bundle)
- store.write_bundle_receipt(bundle)
del bundle
gc.collect()
diff --git a/tempest-pull/app/bundle.py b/tempest-pull/app/bundle.py
index f71374f..b969880 100644
--- a/tempest-pull/app/bundle.py
+++ b/tempest-pull/app/bundle.py
@@ -85,13 +85,15 @@ class Bundle(object):
return
# attempt to retrieve attributes from the first test in the bundle
- attributes = self.data["test_runs"][0]["attributes"]
- if not attributes:
+ if "attributes" in self.data["test_runs"][0]:
+ attributes = self.data["test_runs"][0]["attributes"]
+ else:
print "Invalid bundle data - no test attributes present"
return
- testdef_metadata = self.data["test_runs"][0]["testdef_metadata"]
- if not testdef_metadata:
+ if "testdef_metadata" in self.data["test_runs"][0]:
+ testdef_metadata = self.data["test_runs"][0]["testdef_metadata"]
+ else:
print "Invalid bundle data - no testdef metadata present"
return