Load the debci API status file directly

ubuntu/rebased
Paul Gevers 7 years ago
parent 03292d1df4
commit 93ca29c3aa
No known key found for this signature in database
GPG Key ID: 9C5C99EB05BD750A

@ -17,6 +17,7 @@
# GNU General Public License for more details.
import os
import copy
import json
import tarfile
import io
@ -123,10 +124,28 @@ class AutopkgtestPolicy(BasePolicy):
with open(debci_file) as f:
test_results = json.load(f)
self.log('Read new results from %s' % debci_file)
for result in test_results:
(trigger, src, arch, ver, passed, stamp) = result
self.remove_from_pending(trigger, src, arch)
self.add_trigger_to_results(trigger, src, ver, arch, stamp, passed)
for res in test_results['results']:
# status == null means still running
if res['status'] is not None:
# Blacklisted tests don't get a version
if res['version'] is None:
res['version'] = '0'
(trigger, src, arch, ver, passed, stamp) = ([res['trigger'], res['package'], res['arch'], res['version'], res['status'] == 'pass', res['run_id']])
self.remove_from_pending(trigger, src, arch)
self.add_trigger_to_results(trigger, src, ver, arch, stamp, passed)
self.log('Checking if britney\'s pending tests are known to debci')
pending_tests = copy.deepcopy(self.pending_tests) # copy because we may change the content
for trigger in pending_tests:
for package in pending_tests[trigger]:
for arch in pending_tests[trigger][package]:
found = False
for res in test_results['results']:
if res['trigger'] == trigger and res['package'] == package and res['arch'] == arch:
found = True
break
if not found:
self.log('Removing %s for %s on %s from britney\'s pending list as it isn\'t on debci\'s list' % (package, trigger, arch), 'W')
self.remove_from_pending(trigger, package, arch)
else:
self.log('%s does not exist, no new data will be processed' %
debci_file)

Loading…
Cancel
Save