def on_post(self, external_project_id, **kwargs): project = res.get_or_create_project(external_project_id) data = api.load_body(pecan.request, validator=self.validator) LOG.debug('Start on_post...%s', data) try: container = self.container_repo.get(self.container_id, external_project_id) except exception.NotFound: controllers.containers.container_not_found() self.quota_enforcer.enforce(project) new_consumer = models.ContainerConsumerMetadatum(self.container_id, data) new_consumer.project_id = project.id self.consumer_repo.create_or_update_from(new_consumer, container) url = hrefs.convert_consumer_to_href(new_consumer.container_id) pecan.response.headers['Location'] = url LOG.info(u._LI('Created a consumer for project: %s'), external_project_id) return self._return_container_data(self.container_id, external_project_id)
def on_post(self, external_project_id, **kwargs): project = res.get_or_create_project(external_project_id) data = api.load_body(pecan.request, validator=self.validator) LOG.debug('Start on_post...%s', data) try: container = self.container_repo.get(self.container_id, external_project_id) except exception.NotFound: controllers.containers.container_not_found() new_consumer = models.ContainerConsumerMetadatum(self.container_id, data) new_consumer.project_id = project.id self.consumer_repo.create_or_update_from(new_consumer, container) url = hrefs.convert_consumer_to_href(new_consumer.container_id) pecan.response.headers['Location'] = url LOG.info(u._LI('Created a consumer for project: %s'), external_project_id) return self._return_container_data(self.container_id, external_project_id)
def on_post(self, external_project_id, **kwargs): project = res.get_or_create_project(external_project_id) data = api.load_body(pecan.request, validator=self.validator) LOG.debug('Start on_post...%s', data) self.quota_enforcer.enforce(project) new_consumer = models.ContainerConsumerMetadatum( self.container_id, project.id, data) self.consumer_repo.create_or_update_from(new_consumer, self.container) url = hrefs.convert_consumer_to_href(new_consumer.container_id) pecan.response.headers['Location'] = url LOG.info('Created a container consumer for project: %s', external_project_id) return self._return_container_data()