Get the base image stuff working. Checkpoint before fixing the tests.

This commit is contained in:
jakedt 2014-02-16 17:38:47 -05:00
parent 5742e6ea4e
commit b619356907
120 changed files with 305 additions and 261 deletions

View file

@ -43,7 +43,7 @@ def __gen_image_id(repo, image_num):
global_image_num = [0]
def __create_subtree(repo, structure, parent):
def __create_subtree(repo, structure, creator_username, parent):
num_nodes, subtrees, last_node_tags = structure
# create the nodes
@ -54,7 +54,7 @@ def __create_subtree(repo, structure, parent):
logger.debug('new docker id: %s' % docker_image_id)
checksum = __gen_checksum(docker_image_id)
new_image = model.create_image(docker_image_id, repo)
new_image = model.create_or_link_image(docker_image_id, repo, None)
model.set_image_checksum(docker_image_id, repo, checksum)
creation_time = REFERENCE_DATE + timedelta(days=image_num)
@ -69,7 +69,8 @@ def __create_subtree(repo, structure, parent):
# Populate the diff file
diff_path = store.image_file_diffs_path(repo.namespace, repo.name,
docker_image_id)
docker_image_id,
new_image.storage.uuid)
source_diff = SAMPLE_DIFFS[image_num % len(SAMPLE_DIFFS)]
with open(source_diff, 'r') as source_file:
@ -86,7 +87,7 @@ def __create_subtree(repo, structure, parent):
new_image.docker_image_id)
for subtree in subtrees:
__create_subtree(repo, subtree, new_image)
__create_subtree(repo, subtree, creator_username, new_image)
def __generate_repository(user, name, description, is_public, permissions,
@ -106,9 +107,9 @@ def __generate_repository(user, name, description, is_public, permissions,
if isinstance(structure, list):
for s in structure:
__create_subtree(repo, s, None)
__create_subtree(repo, s, user.username, None)
else:
__create_subtree(repo, structure, None)
__create_subtree(repo, structure, user.username, None)
return repo