def verify_and_get_env(db_session, environment_id, request): environment = db_session.query(models.Environment).get(environment_id) if not environment: LOG.info(_('Environment with id {0} not found').format(environment_id)) raise exc.HTTPNotFound if environment.tenant_id != request.context.tenant: LOG.info(_('User is not authorized to access this tenant resources.')) raise exc.HTTPUnauthorized return environment
def verify_and_get_deployment(db_session, environment_id, deployment_id): deployment = db_session.query(models.Task).get(deployment_id) if not deployment: LOG.error('Deployment with id {id} not found'.format(id=deployment_id)) raise exc.HTTPNotFound if deployment.environment_id != environment_id: LOG.error('Deployment with id {d_id} not found in environment ' '{env_id}'.format(d_id=deployment_id, env_id=environment_id)) raise exc.HTTPBadRequest deployment.description = _patch_description(deployment.description) return deployment
def verify_and_get_deployment(db_session, environment_id, deployment_id): deployment = db_session.query(models.Task).get(deployment_id) if not deployment: LOG.info(_LI('Deployment with id {0} not found').format(deployment_id)) raise exc.HTTPNotFound if deployment.environment_id != environment_id: LOG.info( _LI('Deployment with id {0} not found' ' in environment {1}').format(deployment_id, environment_id)) raise exc.HTTPBadRequest deployment.description = _patch_description(deployment.description) return deployment
def verify_and_get_deployment(db_session, environment_id, deployment_id): deployment = db_session.query(models.Task).get(deployment_id) if not deployment: LOG.info(_('Deployment with id {0} not found').format(deployment_id)) raise exc.HTTPNotFound if deployment.environment_id != environment_id: LOG.info(_('Deployment with id {0} not found' ' in environment {1}').format(deployment_id, environment_id)) raise exc.HTTPBadRequest deployment.description = _patch_description(deployment.description) return deployment
def verify_and_get_deployment(db_session, environment_id, deployment_id): deployment = db_session.query(models.Task).get(deployment_id) if not deployment: LOG.error(_LE('Deployment with id {id} not found') .format(id=deployment_id)) raise exc.HTTPNotFound if deployment.environment_id != environment_id: LOG.error(_LE('Deployment with id {d_id} not found in environment ' '{env_id}').format(d_id=deployment_id, env_id=environment_id)) raise exc.HTTPBadRequest deployment.description = _patch_description(deployment.description) return deployment