Esempio n. 1
0
 def pull_image(self, context, values):
     # ensure defaults are present for new images
     if not values.get('uuid'):
         values['uuid'] = uuidutils.generate_uuid()
     image = models.Image()
     image.update(values)
     try:
         image.save()
     except db_exc.DBDuplicateEntry:
         raise exception.ImageAlreadyExists(tag=values['tag'],
                                            repo=values['repo'])
     return image
Esempio n. 2
0
    def pull_image(self, context, values):
        if not values.get('uuid'):
            values['uuid'] = uuidutils.generate_uuid()
        repo = values.get('repo')
        tag = values.get('tag')

        image = self.get_image_by_repo_and_tag(context, repo, tag)
        if image:
            raise exception.ImageAlreadyExists(repo=repo, tag=tag)

        image = models.Image(values)
        image.save()
        return image