Fix bugs and clean up data in the way diffs are generated.

This commit is contained in:
yackob03 2013-10-18 20:19:05 -04:00
parent 6bebfcc3a1
commit 4679b0dfcc
2 changed files with 16 additions and 9 deletions

View file

@ -339,9 +339,12 @@ def process_image_changes(namespace, repository, image_id):
image_diffs_path = store.image_file_diffs_path(namespace, repository,
image_id)
image_trie_path = store.image_file_trie_path(namespace, repository,
image_id)
if store.exists(image_diffs_path):
logger.debug('Diffs already exist for image: %s' % image_id)
return
return image_trie_path
image = model.get_image_by_id(namespace, repository, image_id)
parents = model.get_parent_images(image)
@ -370,8 +373,7 @@ def process_image_changes(namespace, repository, image_id):
(new_trie, added, changed, removed) = new_metadata
# Write out the new trie
new_trie_path = store.image_file_trie_path(namespace, repository, image_id)
store.put_content(new_trie_path, new_trie.tobytes())
store.put_content(image_trie_path, new_trie.tobytes())
# Write out the diffs
diffs = {}
@ -381,4 +383,4 @@ def process_image_changes(namespace, repository, image_id):
diffs[section].sort()
store.put_content(image_diffs_path, json.dumps(diffs, indent=2))
return new_trie_path
return image_trie_path