Exemplo n.º 1
0
    def create_pod(self, values):
        # ensure defaults are present for new pods
        if not values.get('uuid'):
            values['uuid'] = utils.generate_uuid()

        pod = models.Pod()
        pod.update(values)
        try:
            pod.save()
        except db_exc.DBDuplicateEntry:
            raise exception.PodAlreadyExists(uuid=values['uuid'])
        return pod
Exemplo n.º 2
0
 def test_PodAlreadyExists(self):
     self.assertRaises(exception.PodAlreadyExists,
                       lambda: self.raise_(exception.PodAlreadyExists()))