Beispiel #1
0
    def create_rc(self, values):
        # ensure defaults are present for new ReplicationController
        if not values.get('uuid'):
            values['uuid'] = utils.generate_uuid()

        rc = models.ReplicationController()
        rc.update(values)
        try:
            rc.save()
        except db_exc.DBDuplicateEntry:
            raise exception.ReplicationControllerAlreadyExists(
                uuid=values['uuid'])
        return rc
Beispiel #2
0
 def test_ReplicationControllerAlreadyExists(self):
     self.assertRaises(
         exception.ReplicationControllerAlreadyExists, lambda: self.raise_(
             exception.ReplicationControllerAlreadyExists()))