def POST(self): """ Set a tombstone on a list of replicas. HTTP Success: 201 OK HTTP Error: 401 Unauthorized 404 ReplicaNotFound 500 InternalError """ json_data = data() replicas = [] try: params = parse_response(json_data) if 'replicas' in params: replicas = params['replicas'] except ValueError: raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list') try: for replica in replicas: set_tombstone(replica['rse'], replica['scope'], replica['name'], issuer=ctx.env.get('issuer'), vo=ctx.env.get('vo')) except ReplicaNotFound as error: raise generate_http_error(404, 'ReplicaNotFound', error.args[0]) except RucioException as error: raise generate_http_error(500, error.__class__.__name__, error.args[0]) except Exception as error: print(format_exc()) raise InternalError(error) raise Created()
def post(self): """ Set a tombstone on a list of replicas. .. :quickref: Tombstone; Set a tombstone on a list of replicas. :<json string replicas: list fo replicas :resheader Content-Type: application/x-json-string :status 201: Created. :status 401: Invalid auth token. :status 404: ReplicaNotFound. """ parameters = json_parameters(parse_response) replicas = param_get(parameters, 'replicas', default=[]) try: for replica in replicas: set_tombstone( rse=replica['rse'], scope=replica['scope'], name=replica['name'], issuer=request.environ.get('issuer'), vo=request.environ.get('vo'), ) except ReplicaNotFound as error: return generate_http_error_flask(404, error) except ReplicaIsLocked as error: return generate_http_error_flask(423, error) return 'Created', 201
def post(self): """ Set a tombstone on a list of replicas. .. :quickref: Tombstone; Set a tombstone on a list of replicas. :<json string replicas: list fo replicas :resheader Content-Type: application/x-json-string :status 201: Created. :status 401: Invalid auth token. :status 404: ReplicaNotFound. :status 500: Internal Error. """ json_data = request.data replicas = [] try: params = parse_response(json_data) if 'replicas' in params: replicas = params['replicas'] except ValueError: return generate_http_error_flask(400, 'ValueError', 'Cannot decode json parameter list') try: for replica in replicas: set_tombstone(replica['rse'], replica['scope'], replica['name'], issuer=request.environ.get('issuer'), vo=request.environ.get('vo')) except ReplicaNotFound as error: return generate_http_error_flask(404, 'ReplicaNotFound', error.args[0]) except RucioException as error: return generate_http_error_flask(500, error.__class__.__name__, error.args[0]) except Exception as error: print(format_exc()) return str(error), 500 return 'Created', 201