Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(77)

Unified Diff: charmworld/jobs/ingest.py

Issue 51010046: Clear queues at ingest startup.
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: charmworld/jobs/ingest.py
=== modified file 'charmworld/jobs/ingest.py'
--- charmworld/jobs/ingest.py 2014-01-14 19:48:51 +0000
+++ charmworld/jobs/ingest.py 2014-01-15 20:42:04 +0000
@@ -381,7 +381,10 @@
@staticmethod
def get_deployer_config(fs, basket_data):
hashes = unquote_yaml(basket_data['file_hashes'])
- deployer_config_bytes = fs.get(hashes['bundles.yaml'])
+ yaml_hash = hashes.get('bundles.yaml')
+ if yaml_hash is None:
+ return None
+ deployer_config_bytes = fs.get(yaml_hash)
return yaml.safe_load(deployer_config_bytes)
@staticmethod
@@ -404,19 +407,23 @@
self.decorate_basket(basket_data, fs)
self.db.baskets.save(basket_data)
deployer_config = self.get_deployer_config(fs, basket_data)
- lint, err = self.proof(basket_data['branch_dir'])
- if err:
- # Reject the entire basket.
- self.log.error('Rejecting {} due to proof errors.'.format(
+ if deployer_config is None:
+ self.log.error('No deployer config file found for {}.'.format(
rharding 2014/01/16 17:34:35 since we're looking for bundles.yaml, should we sp
basket_data['branch_spec']))
- for l in lint:
- self.log.error('\t{}'.format(l))
else:
- self.store_bundles(
- deployer_config, basket_data['owner'],
- basket_data['name_revno'],
- basket_data['first_change'], basket_data['last_change'],
- basket_data['changes'], basket_data['branch_spec'])
+ lint, err = self.proof(basket_data['branch_dir'])
+ if err:
+ # Reject the entire basket.
+ self.log.error('Rejecting {} due to proof errors.'.format(
+ basket_data['branch_spec']))
+ for l in lint:
+ self.log.error('\t{}'.format(l))
+ else:
+ self.store_bundles(
+ deployer_config, basket_data['owner'],
+ basket_data['name_revno'],
+ basket_data['first_change'], basket_data['last_change'],
+ basket_data['changes'], basket_data['branch_spec'])
self.update_ingest_status()
@@ -597,7 +604,12 @@
def scan_charm(charm_data, fs, log):
# Note: charm_data is modified in-place. IndexIngestJob requires
# these modifications.
- files = charm_data['files']
+ files = charm_data.get('files')
+ if files is None:
+ raise IngestError(
+ 'Charm contains no files: {}'.format(
+ charm_data['branch_spec']))
+
# Some files have bad characters in them since they are used as mongo
# keys. Use their escaped forms instead.
metadata_file = quote_key('metadata.yaml')
« no previous file with comments | « [revision details] ('k') | charmworld/jobs/lp.py » ('j') | charmworld/models.py » ('J')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b