Пример #1
0
 def create_service(self, values):
     try:
         service = self._create(models.Service, values)
     except db_exc.DBDuplicateEntry:
         raise exception.ServiceAlreadyExists(name=values['name'],
                                              host=values['host'])
     return service
Пример #2
0
 def create_service(self, values):
     service = models.Service()
     service.update(values)
     try:
         service.save()
     except db_exc.DBDuplicateEntry:
         raise exception.ServiceAlreadyExists(name=values['name'],
                                              host=values['host'])
     return service