def GET(self, rse): """ Get account usage and limit for one RSE. :param rse: the RSE name. """ header('Content-Type', 'application/json') try: usage = get_rse_account_usage(rse=rse) for row in usage: yield dumps(row, cls=APIEncoder) + '\n' except RSENotFound as error: raise generate_http_error(404, 'RSENotFound', 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)
def GET(self, source, destination): """ Get RSE distance between source and destination. :param rse: the RSE name. """ header('Content-Type', 'application/json') try: distance = get_distance(source=source, destination=destination, issuer=ctx.env.get('issuer')) return dumps(distance, cls=APIEncoder) except RSENotFound as error: raise generate_http_error(404, 'RSENotFound', 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)
def PUT(self, rse): """ Update RSE properties (e.g. name, availability). HTTP Success: 201 Created HTTP Error: 400 Bad request 401 Unauthorized 404 Resource not Found 409 Conflict 500 Internal Error """ json_data = data() kwargs = {} try: parameters = json_data and loads(json_data) kwargs['parameters'] = parameters except ValueError: raise generate_http_error( 400, 'ValueError', 'Cannot decode json parameter dictionary') kwargs['issuer'] = ctx.env.get('issuer') try: update_rse(rse, **kwargs) except InvalidObject as error: raise generate_http_error(400, 'InvalidObject', error.args[0]) except AccessDenied as error: raise generate_http_error(401, 'AccessDenied', error.args[0]) except RSENotFound as error: raise generate_http_error(404, 'RSENotFound', error.args[0]) except Duplicate as error: raise generate_http_error(409, 'Duplicate', error.args[0]) except RucioException as error: raise generate_http_error(500, error.__class__.__name__, error.args[0]) except Exception as error: print(error) print(format_exc()) raise InternalError(error) raise Created()
def POST(self): json_data = data() try: dids = loads(json_data) except ValueError: raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list') try: add_temporary_dids(dids=dids, issuer=ctx.env.get('issuer'), vo=ctx.env.get('vo')) 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 DELETE(self, account): """ Delete an account's identity mapping. HTTP Success: 200 Created HTTP Error: 400 Bad Reqeust 401 Unauthorized 404 Not Found 500 Internal Error :param account: Account identifier. """ json_data = data() try: parameter = loads(json_data) except ValueError: raise generate_http_error( 400, 'ValueError', 'cannot decode json parameter dictionary') try: identity = parameter['identity'] authtype = parameter['authtype'] except KeyError as error: if error.args[0] == 'authtype' or error.args[0] == 'identity': raise generate_http_error(400, 'KeyError', '%s not defined' % str(error)) except TypeError: raise generate_http_error(400, 'TypeError', 'body must be a json dictionary') try: del_account_identity(identity, authtype, account, ctx.env.get('issuer')) except AccessDenied as error: raise generate_http_error(401, 'AccessDenied', error.args[0]) except AccountNotFound as error: raise generate_http_error(404, 'AccountNotFound', error.args[0]) except IdentityError as error: raise generate_http_error(404, 'IdentityError', error.args[0]) except Exception as error: print(format_exc()) raise InternalError(error) raise OK()
def POST(self, key): """ Create a new allowed key (value is NULL). HTTP Success: 201 Created HTTP Error: 401 Unauthorized 404 Not Found 409 Conflict 500 Internal Error :param Rucio-Auth-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :params Rucio-Account: account belonging to the new scope. """ json_data = data() try: params = json_data and loads(json_data) if params and 'value_type' in params: value_type = params['value_type'] if params and 'value_regexp' in params: value_regexp = params['value_regexp'] if params and 'key_type' in params: key_type = params['key_type'] except ValueError: raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list') try: add_key(key=key, key_type=key_type, value_type=value_type, value_regexp=value_regexp, issuer=ctx.env.get('issuer')) except Duplicate as error: raise generate_http_error(409, 'Duplicate', error.args[0]) except UnsupportedValueType as error: raise generate_http_error(400, 'UnsupportedValueType', error.args[0]) except UnsupportedKeyType as error: raise generate_http_error(400, 'UnsupportedKeyType', error.args[0]) except RucioException as error: raise generate_http_error(500, error.__class__.__name__, error.args[0]) except Exception as error: raise InternalError(error) raise Created()
def GET(self, identity_key, type): """ Return all identities mAPPed to an account. HTTP Success: 200 OK HTTP Error: 400 Bad Reqeust 401 Unauthorized 500 Internal Error :param account: Identity string. """ try: return json.dumps(list_accounts_for_identity(identity_key, type)) except Exception as error: print str(format_exc()) raise InternalError(error)
def POST(self, rule_id): """ Reduce a replication rule. HTTP Success: 201 Created HTTP Error: 400 Bad Request 401 Unauthorized 404 Not Found 409 Conflict 500 Internal Error """ json_data = data() try: exclude_expression = None params = loads(json_data) copies = params['copies'] if 'exclude_expression' in params: exclude_expression = params['exclude_expression'] except ValueError: raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list') try: rule_ids = reduce_replication_rule(rule_id=rule_id, copies=copies, exclude_expression=exclude_expression, issuer=ctx.env.get('issuer')) # TODO: Add all other error cases here except RuleReplaceFailed as error: raise generate_http_error(409, 'RuleReplaceFailed', error.args[0][0]) except RuleNotFound as error: raise generate_http_error(404, 'RuleNotFound', error.args[0][0]) except RucioException as error: raise generate_http_error(500, error.__class__.__name__, error.args[0]) except Exception as error: print error print format_exc() raise InternalError(error) raise Created(dumps(rule_ids))
def POST(self): """ Create a new Lifetime Model exception. HTTP Success: 201 Created HTTP Error: 400 Bad Request 401 Unauthorized 409 Conflict 500 Internal Error """ json_data = data() dids, pattern, comments, expires_at = [], None, None, None try: params = loads(json_data) if 'dids' in params: dids = params['dids'] if 'pattern' in params: pattern = params['pattern'] if 'comments' in params: comments = params['comments'] if 'expires_at' in params: expires_at = params['expires_at'] except ValueError: raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list') try: exception_id = add_exception(dids=dids, account=ctx.env.get('issuer'), vo=ctx.env.get('vo'), pattern=pattern, comments=comments, expires_at=expires_at) except InvalidObject as error: raise generate_http_error(400, 'InvalidObject', error.args[0]) except AccessDenied as error: raise generate_http_error(401, 'AccessDenied', error.args[0]) except LifetimeExceptionDuplicate as error: raise generate_http_error(409, 'LifetimeExceptionDuplicate', error.args[0]) except RucioException as error: raise generate_http_error(500, error.__class__.__name__, error.args[0]) except Exception as error: raise InternalError(error) raise Created(dumps(exception_id))
def POST(self, account, rse): """ Create or update an account limit. HTTP Success: 201 Created HTTP Error: 400 Bad Request 401 Unauthorized 404 Not Found 500 Internal Error :param X-Rucio-Auth-Account: Account identifier. :param X-Rucio-Auth-Token: As an 32 character hex string. :param account: Account name. :param rse: RSE name. """ json_data = data() try: parameter = loads(json_data) except ValueError: raise generate_http_error(400, 'ValueError', 'cannot decode json parameter dictionary') try: bytes = parameter['bytes'] except KeyError as exception: if exception.args[0] == 'type': raise generate_http_error(400, 'KeyError', '%s not defined' % str(exception)) except TypeError: raise generate_http_error(400, 'TypeError', 'body must be a json dictionary') try: set_account_limit(account=account, rse=rse, bytes=bytes, issuer=ctx.env.get('issuer'), vo=ctx.env.get('vo')) except AccessDenied as exception: raise generate_http_error(401, 'AccessDenied', exception.args[0]) except RSENotFound as exception: raise generate_http_error(404, 'RSENotFound', exception.args[0]) except AccountNotFound as exception: raise generate_http_error(404, 'AccountNotFound', exception.args[0]) except Exception as exception: print(format_exc()) raise InternalError(exception) raise Created()
def POST(self, rse, key): """ create rse with given RSE name. HTTP Success: 201 Created HTTP Error: 400 Bad request 401 Unauthorized 500 Internal Error :param rse: RSE name. :param key: Key attribute. """ json_data = data() try: parameter = loads(json_data) except ValueError: raise generate_http_error( 400, 'ValueError', 'Cannot decode json parameter dictionary') try: value = parameter['value'] except KeyError as error: raise generate_http_error(400, 'KeyError', '%s not defined' % str(error)) try: add_rse_attribute(rse=rse, key=key, value=value, issuer=ctx.env.get('issuer'), vo=ctx.env.get('vo')) except AccessDenied as error: raise generate_http_error(401, 'AccessDenied', error.args[0]) except Duplicate as error: raise generate_http_error(409, 'Duplicate', error.args[0]) except Exception as error: raise InternalError(error) raise Created()
def POST(self): # To be moved in a common processor attachments, ignore_duplicate = [], False try: json_data = loads(data()) if type(json_data) is dict: attachments = json_data.get('attachments') ignore_duplicate = json_data.get('ignore_duplicate') elif type(json_data) is list: attachments = json_data except ValueError: raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list') try: attach_dids_to_dids(attachments=attachments, ignore_duplicate=ignore_duplicate, issuer=ctx.env.get('issuer'), vo=ctx.env.get('vo')) except DataIdentifierNotFound as error: raise generate_http_error(404, 'DataIdentifierNotFound', error.args[0]) except DuplicateContent as error: raise generate_http_error(409, 'DuplicateContent', error.args[0]) except DataIdentifierAlreadyExists as error: raise generate_http_error(409, 'DataIdentifierAlreadyExists', error.args[0]) except AccessDenied as error: raise generate_http_error(401, 'AccessDenied', error.args[0]) except UnsupportedOperation as error: raise generate_http_error(409, 'UnsupportedOperation', 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 GET(self, scope): """ List all data identifiers in a scope which match a given metadata. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 KeyNotFound 406 Not Acceptable 409 UnsupportedOperation :param scope: The scope name. """ header('Content-Type', 'application/x-json-stream') filters = {} long = False recursive = False if ctx.query: params = parse_qs(ctx.query[1:]) for k, v in params.items(): if k == 'type': type = v[0] elif k == 'long': long = v[0] == '1' elif k == 'recursive': recursive = v[0] == 'True' else: filters[k] = v[0] try: for did in list_dids(scope=scope, filters=filters, type=type, long=long, recursive=recursive): yield dumps(did) + '\n' except UnsupportedOperation as error: raise generate_http_error(409, 'UnsupportedOperation', error.args[0]) except KeyNotFound as error: raise generate_http_error(404, 'KeyNotFound', error.args[0]) except Exception as error: print(format_exc()) raise InternalError(error)
def DELETE(self): """ Delete file replicas at a given RSE. HTTP Success: 200 Ok HTTP Error: 401 Unauthorized 409 Conflict 500 Internal Error """ json_data = data() try: parameters = parse_response(json_data) except ValueError: raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list') try: delete_replicas(rse=parameters['rse'], files=parameters['files'], issuer=ctx.env.get('issuer'), vo=ctx.env.get('vo'), ignore_availability=parameters.get( 'ignore_availability', False)) except AccessDenied as error: raise generate_http_error(401, 'AccessDenied', error.args[0]) except RSENotFound as error: raise generate_http_error(404, 'RSENotFound', error.args[0]) except ResourceTemporaryUnavailable as error: raise generate_http_error(503, 'ResourceTemporaryUnavailable', error.args[0]) 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 OK()
def POST(self): """ Declare a list of bad replicas. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError """ json_data = data() pfns = [] header('Content-Type', 'application/json') try: params = parse_response(json_data) if 'pfns' in params: pfns = params['pfns'] if 'reason' in params: reason = params['reason'] except ValueError: raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list') not_declared_files = {} try: not_declared_files = declare_bad_file_replicas( pfns=pfns, reason=reason, issuer=ctx.env.get('issuer')) except AccessDenied as error: raise generate_http_error(401, 'AccessDenied', error.args[0]) 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(dumps(not_declared_files))
def PUT(self, exception_id): """ Approve/Reject an execption. HTTP Success: 201 Created HTTP Error: 400 Bad Request 401 Unauthorized 404 Not Found 500 Internal Error """ json_data = data() try: params = loads(json_data) except ValueError: raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list') try: state = params['state'] except KeyError: state = None try: update_exception(exception_id=exception_id, state=state, issuer=ctx.env.get('issuer'), vo=ctx.env.get('vo')) except UnsupportedOperation as error: raise generate_http_error(400, 'UnsupportedOperation', error.args[0]) except AccessDenied as error: raise generate_http_error(401, 'AccessDenied', error.args[0]) except LifetimeExceptionNotFound as error: raise generate_http_error(404, 'LifetimeExceptionNotFound', error.args[0]) except RucioException as error: raise generate_http_error(500, error.__class__.__name__, error.args[0]) except Exception as error: raise InternalError(error) raise Created()
def DELETE(self, rse, qos_policy): """ Delete QoS policy from an RSE. :param rse: the RSE name. :param qos_policy: the QoS policy. """ header('Content-Type', 'application/json') try: delete_qos_policy(rse=rse, qos_policy=qos_policy, issuer=ctx.env.get('issuer'), vo=ctx.env.get('vo')) except RSENotFound as error: raise generate_http_error(404, 'RSENotFound', 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 OK()
def GET(self, rse): """ Get RSE limits. :param rse: the RSE name. """ header('Content-Type', 'application/json') try: limits = get_rse_limits(rse=rse, issuer=ctx.env.get('issuer'), vo=ctx.env.get('vo')) return render_json(**limits) except RSENotFound as error: raise generate_http_error(404, 'RSENotFound', 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)
def PUT(self, rse, scheme, hostname=None, port=None): """ Updates attributes of an existing protocol entry. Because protocol identifier, hostname, and port are used as unique identifier they are immutable. HTTP Success: 200 OK HTTP Error: 400 Bad Request 401 Unauthorized 404 Resource not Found 409 Conflict 500 InternalError """ json_data = data().decode() try: parameter = loads(json_data) except ValueError: raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter dictionary') try: update_protocols(rse, issuer=ctx.env.get('issuer'), vo=ctx.env.get('vo'), scheme=scheme, hostname=hostname, port=port, data=parameter) except InvalidObject as error: raise generate_http_error(400, 'InvalidObject', error.args[0]) except RSEProtocolNotSupported as error: raise generate_http_error(404, 'RSEProtocolNotSupported', error.args[0]) except RSENotFound as error: raise generate_http_error(404, 'RSENotFound', error.args[0]) except RSEProtocolDomainNotSupported as error: raise generate_http_error(404, 'RSEProtocolDomainNotSupported', error.args[0]) except RSEProtocolPriorityError as error: raise generate_http_error(409, 'RSEProtocolPriorityError', error.args[0]) except RucioException as error: raise generate_http_error(500, error.__class__.__name__, error.args[0]) except Exception as error: print(error) print(format_exc()) raise InternalError(error) raise OK()
def rucio_loadhook(): """ Rucio load Hook to authenticate, timing, etc. """ # Allow cross-site scripting header('Access-Control-Allow-Origin', ctx.env.get('HTTP_ORIGIN')) header('Access-Control-Allow-Headers', ctx.env.get('HTTP_ACCESS_CONTROL_REQUEST_HEADERS')) header('Access-Control-Allow-Methods', '*') header('Access-Control-Allow-Credentials', 'true') if ctx.env.get('REQUEST_METHOD') == 'OPTIONS': raise OK if ctx.env.get('REQUEST_METHOD') == 'GET': header('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate') header('Cache-Control', 'post-check=0, pre-check=0', False) header('Pragma', 'no-cache') else: header('Content-Type', 'application/octet-stream') auth_token = ctx.env.get('HTTP_X_RUCIO_AUTH_TOKEN') try: auth = validate_auth_token(auth_token) 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) if auth is None: raise generate_http_error( 401, 'CannotAuthenticate', 'Cannot authenticate with given credentials') # Propagate the issuer, request_id and start_time to the controller ctx.env['vo'] = auth.get('vo') ctx.env['issuer'] = auth.get('account') ctx.env['identity'] = auth.get('identity') ctx.env['request_id'] = generate_uuid() ctx.env['start_time'] = time()
def DELETE(self, scope, name): """ Detach data identifiers from data identifiers. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 500 InternalError :param scope: Detach the data identifier from this scope. :param name: Detach the data identifier from this name. """ try: json_data = loads(data()) if 'dids' in json_data: dids = json_data['dids'] except ValueError: raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list') try: detach_dids(scope=scope, name=name, dids=dids, issuer=ctx.env.get('issuer'), vo=ctx.env.get('vo')) except UnsupportedOperation as error: raise generate_http_error(409, 'UnsupportedOperation', error.args[0]) except DataIdentifierNotFound as error: raise generate_http_error(404, 'DataIdentifierNotFound', error.args[0]) except AccessDenied as error: raise generate_http_error(401, 'AccessDenied', error.args[0]) except Exception as error: print(format_exc()) raise InternalError(error) raise OK()
def POST(self, rule_id): """ Move a replication rule. HTTP Success: 201 Created HTTP Error: 400 Bad Request 401 Unauthorized 404 Not Found 409 Conflict 500 Internal Error """ json_data = data() try: params = loads(json_data) rule_id = params['rule_id'] rse_expression = params['rse_expression'] except ValueError: raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list') try: rule_ids = move_replication_rule(rule_id=rule_id, rse_expression=rse_expression, issuer=ctx.env.get('issuer'), vo=ctx.env.get('vo')) except RuleReplaceFailed as error: raise generate_http_error(409, 'RuleReplaceFailed', error.args[0]) except RuleNotFound as error: raise generate_http_error(404, 'RuleNotFound', error.args[0]) except RucioException as error: raise generate_http_error(500, error.__class__.__name__, error.args[0]) except Exception as error: print(error) print(format_exc()) raise InternalError(error) raise Created(dumps(rule_ids))
def GET(self): """ Return a summary of the bad replicas by incident. HTTP Success: 200 OK HTTP Error: 406 Not Acceptable 500 InternalError """ header('Content-Type', 'application/x-json-stream') result = [] rse_expression, from_date, to_date = None, None, None if ctx.query: try: params = loads(unquote(ctx.query[1:])) except ValueError: params = parse_qs(ctx.query[1:]) if 'rse_expression' in params: rse_expression = params['rse_expression'][0] if 'from_date' in params and params['from_date'][0]: from_date = datetime.strptime(params['from_date'][0], "%Y-%m-%d") if 'to_date' in params: to_date = datetime.strptime(params['to_date'][0], "%Y-%m-%d") try: result = get_bad_replicas_summary(rse_expression=rse_expression, from_date=from_date, to_date=to_date, vo=ctx.env.get('vo')) 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) for row in result: yield dumps(row, cls=APIEncoder) + '\n'
def GET(self): """ List the suspicious replicas on a lsit of RSEs. HTTP Success: 200 OK HTTP Error: 406 Not Acceptable 500 InternalError """ header('Content-Type', 'application/json') result = [] rse_expression, younger_than, nattempts = None, None, None if ctx.query: try: params = loads(unquote(ctx.query[1:])) except ValueError: params = parse_qs(ctx.query[1:]) print(params) if 'rse_expression' in params: rse_expression = params['rse_expression'][0] if 'younger_than' in params and params['younger_than'][0]: younger_than = datetime.strptime(params['younger_than'][0], "%Y-%m-%dT%H:%M:%S") if 'nattempts' in params: nattempts = int(params['nattempts'][0]) try: result = get_suspicious_files(rse_expression=rse_expression, younger_than=younger_than, nattempts=nattempts, vo=ctx.env.get('vo')) 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) return render_json_list(result)
def POST(self): """ Resurrect DIDs. HTTP Success: 201 Created HTTP Error: 401 Unauthorized 404 Not Found 409 Conflict 500 Internal Error """ json_data = data() try: dids = loads(json_data) except ValueError: raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list') try: resurrect(dids=dids, issuer=ctx.env.get('issuer')) except DataIdentifierNotFound as error: raise generate_http_error(404, 'DataIdentifierNotFound', error.args[0]) except DuplicateContent as error: raise generate_http_error(409, 'DuplicateContent', error.args[0]) except DataIdentifierAlreadyExists as error: raise generate_http_error(409, 'DataIdentifierAlreadyExists', error.args[0]) except AccessDenied as error: raise generate_http_error(401, 'AccessDenied', error.args[0]) except UnsupportedOperation as error: raise generate_http_error(409, 'UnsupportedOperation', error.args[0]) except DatabaseException as error: raise generate_http_error(500, 'DatabaseException', 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 GET(self, account, name=None): """ Return a summary of the states of all rules of a given subscription id. HTTP Success: 200 OK HTTP Error: 404 Not Found 406 Not Acceptable 500 Internal Error """ header('Content-Type', 'application/x-json-stream') try: for row in list_subscription_rule_states(account=account, vo=ctx.env.get('vo')): yield dumps(row, cls=APIEncoder) + '\n' except RucioException as error: raise generate_http_error(500, error.__class__.__name__, error.args[0]) except Exception as error: raise InternalError(error)
def PUT(self, account): """ Create a new identity and map it to an account. HTTP Success: 201 Created HTTP Error: 400 Bad Request 401 Unauthorized 500 Internal Error :param Rucio-Auth-Token: as an 32 character hex string. :param SavedCredentials: Apache mod_auth_kerb SavedCredentials. :param account: the affected account via URL. """ gsscred = ctx.env.get('REMOTE_USER') try: add_identity(gsscred, 'gss', email=None) except Exception, error: raise InternalError(error)
def PUT(self, account): """ Create a new identity and map it to an account. HTTP Success: 201 Created HTTP Error: 400 Bad Request 401 Unauthorized 500 Internal Error :param Rucio-Auth-Token: as an 32 character hex string. :param SSLStdEnv: Apache mod_ssl SSL Standard Env Variables. :param account: the affected account via URL. """ dn = ctx.env.get('SSL_CLIENT_S_DN') try: add_identity(dn, 'x509', email=None) except Exception, error: raise InternalError(error)
def DELETE(self, rse, key): """ delete RSE attribute HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 500 InternalError """ try: del_rse_attribute(rse=rse, key=key, issuer=ctx.env.get('issuer'), vo=ctx.env.get('vo')) except AccessDenied as error: raise generate_http_error(401, 'AccessDenied', error.args[0]) except RSENotFound as error: raise generate_http_error(404, 'RSENotFound', error.args[0]) except RSEAttributeNotFound as error: raise generate_http_error(404, 'RSEAttributeNotFound', error.args[0]) except Exception as error: raise InternalError(error) raise OK()
def GET(self, rule_id): """ get analysis for given rule. HTTP Success: 200 OK HTTP Error: 404 Not Found 500 InternalError :returns: JSON dict containing informations about the requested user. """ header('Content-Type', 'application/x-json-stream') try: analysis = examine_replication_rule(rule_id) except RucioException as error: raise generate_http_error(500, error.__class__.__name__, error.args[0]) except Exception as error: raise InternalError(error) return render_json(**analysis)