def job_destroy(context, job_id): session = get_session() try: with session.begin(): job = _job_get(context, session, job_id) if not job: raise ex.NotFoundException(job_id, "Job id '%s' not found!") session.delete(job) except db_exc.DBError as e: msg = "foreign key constraint" in e.message and\ " on foreign key constraint" or "" raise ex.DeletionFailed("Job deletion failed%s" % msg)
def job_binary_destroy(context, job_binary_id): session = get_session() with session.begin(): job_binary = _job_binary_get(context, session, job_binary_id) if not job_binary: raise ex.NotFoundException(job_binary_id, "JobBinary id '%s' not found!") if _check_job_binary_referenced(context, session, job_binary_id): raise ex.DeletionFailed("JobBinary is referenced" "and cannot be deleted") session.delete(job_binary)
def data_source_destroy(context, data_source_id): session = get_session() try: with session.begin(): data_source = _data_source_get(context, session, data_source_id) if not data_source: raise ex.NotFoundException(data_source_id, "Data Source id '%s' not found!") session.delete(data_source) except db_exc.DBError as e: msg = "foreign key constraint" in e.message and\ " on foreign key constraint" or "" raise ex.DeletionFailed("Data Source deletion failed%s" % msg)