rucio 38.3.0__py3-none-any.whl → 38.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rucio might be problematic. Click here for more details.
- rucio/cli/bin_legacy/rucio.py +12 -7
- rucio/cli/bin_legacy/rucio_admin.py +9 -2
- rucio/cli/did.py +1 -1
- rucio/cli/opendata.py +19 -2
- rucio/cli/replica.py +6 -2
- rucio/cli/rule.py +0 -1
- rucio/cli/scope.py +9 -0
- rucio/cli/utils.py +11 -0
- rucio/client/accountclient.py +20 -19
- rucio/client/accountlimitclient.py +5 -4
- rucio/client/baseclient.py +25 -25
- rucio/client/configclient.py +7 -6
- rucio/client/credentialclient.py +2 -1
- rucio/client/didclient.py +33 -32
- rucio/client/diracclient.py +2 -1
- rucio/client/downloadclient.py +3 -1
- rucio/client/exportclient.py +2 -1
- rucio/client/importclient.py +2 -1
- rucio/client/lifetimeclient.py +3 -2
- rucio/client/lockclient.py +4 -3
- rucio/client/metaconventionsclient.py +5 -4
- rucio/client/opendataclient.py +8 -7
- rucio/client/pingclient.py +2 -1
- rucio/client/replicaclient.py +27 -26
- rucio/client/requestclient.py +8 -8
- rucio/client/rseclient.py +31 -28
- rucio/client/ruleclient.py +13 -12
- rucio/client/scopeclient.py +44 -4
- rucio/client/subscriptionclient.py +6 -5
- rucio/common/constants.py +18 -0
- rucio/common/didtype.py +18 -11
- rucio/common/exception.py +20 -0
- rucio/common/plugins.py +9 -7
- rucio/core/credential.py +19 -26
- rucio/core/did.py +1 -1
- rucio/core/did_meta_plugins/__init__.py +2 -1
- rucio/core/did_meta_plugins/did_column_meta.py +2 -10
- rucio/core/did_meta_plugins/did_meta_plugin_interface.py +39 -25
- rucio/core/did_meta_plugins/elasticsearch_meta.py +3 -11
- rucio/core/did_meta_plugins/json_meta.py +2 -8
- rucio/core/did_meta_plugins/mongo_meta.py +3 -12
- rucio/core/did_meta_plugins/postgres_meta.py +7 -14
- rucio/core/dirac.py +1 -1
- rucio/core/opendata.py +150 -8
- rucio/core/rse.py +6 -2
- rucio/core/rule_grouping.py +3 -3
- rucio/core/scope.py +47 -7
- rucio/daemons/automatix/automatix.py +2 -0
- rucio/db/sqla/models.py +22 -0
- rucio/gateway/account.py +8 -7
- rucio/gateway/did.py +1 -1
- rucio/gateway/dirac.py +1 -1
- rucio/gateway/opendata.py +2 -2
- rucio/gateway/request.py +2 -117
- rucio/gateway/scope.py +35 -3
- rucio/rse/protocols/webdav.py +5 -2
- rucio/transfertool/fts3.py +0 -19
- rucio/vcsversion.py +3 -3
- rucio/web/rest/flaskapi/v1/accountlimits.py +4 -3
- rucio/web/rest/flaskapi/v1/accounts.py +26 -25
- rucio/web/rest/flaskapi/v1/archives.py +2 -2
- rucio/web/rest/flaskapi/v1/auth.py +15 -14
- rucio/web/rest/flaskapi/v1/common.py +4 -4
- rucio/web/rest/flaskapi/v1/config.py +6 -4
- rucio/web/rest/flaskapi/v1/credentials.py +3 -3
- rucio/web/rest/flaskapi/v1/dids.py +25 -24
- rucio/web/rest/flaskapi/v1/dirac.py +3 -2
- rucio/web/rest/flaskapi/v1/export.py +4 -2
- rucio/web/rest/flaskapi/v1/heartbeats.py +2 -1
- rucio/web/rest/flaskapi/v1/identities.py +5 -4
- rucio/web/rest/flaskapi/v1/import.py +3 -2
- rucio/web/rest/flaskapi/v1/lifetime_exceptions.py +3 -2
- rucio/web/rest/flaskapi/v1/locks.py +4 -3
- rucio/web/rest/flaskapi/v1/meta_conventions.py +4 -3
- rucio/web/rest/flaskapi/v1/metrics.py +2 -1
- rucio/web/rest/flaskapi/v1/nongrid_traces.py +2 -1
- rucio/web/rest/flaskapi/v1/opendata.py +28 -27
- rucio/web/rest/flaskapi/v1/opendata_public.py +12 -11
- rucio/web/rest/flaskapi/v1/ping.py +3 -2
- rucio/web/rest/flaskapi/v1/redirect.py +4 -3
- rucio/web/rest/flaskapi/v1/replicas.py +31 -31
- rucio/web/rest/flaskapi/v1/requests.py +7 -7
- rucio/web/rest/flaskapi/v1/rses.py +23 -16
- rucio/web/rest/flaskapi/v1/rules.py +9 -8
- rucio/web/rest/flaskapi/v1/scopes.py +66 -13
- rucio/web/rest/flaskapi/v1/subscriptions.py +9 -8
- rucio/web/rest/flaskapi/v1/traces.py +2 -1
- rucio/web/rest/flaskapi/v1/vos.py +4 -3
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/etc/rucio.cfg.template +2 -3
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/etc/rucio_multi_vo.cfg.template +2 -3
- {rucio-38.3.0.dist-info → rucio-38.5.0.dist-info}/METADATA +1 -1
- {rucio-38.3.0.dist-info → rucio-38.5.0.dist-info}/RECORD +149 -149
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/etc/alembic.ini.template +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/etc/alembic_offline.ini.template +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/etc/globus-config.yml.template +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/etc/ldap.cfg.template +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/etc/mail_templates/rule_approval_request.tmpl +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/etc/mail_templates/rule_approved_admin.tmpl +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/etc/mail_templates/rule_approved_user.tmpl +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/etc/mail_templates/rule_denied_admin.tmpl +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/etc/mail_templates/rule_denied_user.tmpl +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/etc/mail_templates/rule_ok_notification.tmpl +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/etc/rse-accounts.cfg.template +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/etc/rucio.cfg.atlas.client.template +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/requirements.server.txt +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/tools/bootstrap.py +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/tools/merge_rucio_configs.py +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/data/rucio/tools/reset_database.py +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-abacus-account +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-abacus-collection-replica +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-abacus-rse +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-admin +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-atropos +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-auditor +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-automatix +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-bb8 +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-cache-client +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-cache-consumer +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-conveyor-finisher +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-conveyor-poller +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-conveyor-preparer +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-conveyor-receiver +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-conveyor-stager +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-conveyor-submitter +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-conveyor-throttler +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-dark-reaper +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-dumper +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-follower +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-hermes +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-judge-cleaner +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-judge-evaluator +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-judge-injector +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-judge-repairer +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-kronos +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-minos +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-minos-temporary-expiration +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-necromancer +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-oauth-manager +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-reaper +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-replica-recoverer +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-rse-decommissioner +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-storage-consistency-actions +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-transmogrifier +0 -0
- {rucio-38.3.0.data → rucio-38.5.0.data}/scripts/rucio-undertaker +0 -0
- {rucio-38.3.0.dist-info → rucio-38.5.0.dist-info}/WHEEL +0 -0
- {rucio-38.3.0.dist-info → rucio-38.5.0.dist-info}/licenses/AUTHORS.rst +0 -0
- {rucio-38.3.0.dist-info → rucio-38.5.0.dist-info}/licenses/LICENSE +0 -0
- {rucio-38.3.0.dist-info → rucio-38.5.0.dist-info}/top_level.txt +0 -0
|
@@ -38,7 +38,8 @@ class JSONDidMeta(DidMetaPlugin):
|
|
|
38
38
|
|
|
39
39
|
def __init__(self):
|
|
40
40
|
super(JSONDidMeta, self).__init__()
|
|
41
|
-
|
|
41
|
+
|
|
42
|
+
self._plugin_name = "JSON"
|
|
42
43
|
|
|
43
44
|
@read_session
|
|
44
45
|
def get_metadata(self, scope, name, *, session: "Session"):
|
|
@@ -231,10 +232,3 @@ class JSONDidMeta(DidMetaPlugin):
|
|
|
231
232
|
@read_session
|
|
232
233
|
def manages_key(self, key, *, session: "Session"):
|
|
233
234
|
return json_implemented(session=session)
|
|
234
|
-
|
|
235
|
-
def get_plugin_name(self):
|
|
236
|
-
"""
|
|
237
|
-
Returns a unique identifier for this plugin. This can be later used for filtering down results to this plugin only.
|
|
238
|
-
:returns: The name of the plugin.
|
|
239
|
-
"""
|
|
240
|
-
return self.plugin_name
|
|
@@ -81,7 +81,7 @@ class MongoDidMeta(DidMetaPlugin):
|
|
|
81
81
|
self.db = self.client[con_params['mongo_db']]
|
|
82
82
|
self.col = self.db[con_params['mongo_collection']]
|
|
83
83
|
|
|
84
|
-
self.
|
|
84
|
+
self._plugin_name = "MONGO"
|
|
85
85
|
|
|
86
86
|
def drop_database(self):
|
|
87
87
|
self.client.drop_database(self.db.name)
|
|
@@ -188,9 +188,8 @@ class MongoDidMeta(DidMetaPlugin):
|
|
|
188
188
|
if recursive:
|
|
189
189
|
# TODO: possible, but requires retrieving the results of a concurrent sqla query to call list_content on for datasets and containers
|
|
190
190
|
raise exception.UnsupportedOperation(
|
|
191
|
-
"'{}' metadata module does not currently support recursive searches".format(
|
|
192
|
-
|
|
193
|
-
))
|
|
191
|
+
"'{}' metadata module does not currently support recursive searches".format(self.name)
|
|
192
|
+
)
|
|
194
193
|
|
|
195
194
|
if long:
|
|
196
195
|
query_result = self.col.find(mongo_query_str)
|
|
@@ -219,11 +218,3 @@ class MongoDidMeta(DidMetaPlugin):
|
|
|
219
218
|
|
|
220
219
|
def manages_key(self, key, *, session: "Optional[Session]" = None):
|
|
221
220
|
return True
|
|
222
|
-
|
|
223
|
-
def get_plugin_name(self):
|
|
224
|
-
"""
|
|
225
|
-
Returns a unique identifier for this plugin. This can be later used for filtering down results to this plugin only.
|
|
226
|
-
|
|
227
|
-
:returns: The name of the plugin
|
|
228
|
-
"""
|
|
229
|
-
return self.plugin_name
|
|
@@ -95,7 +95,7 @@ class ExternalPostgresJSONDidMeta(DidMetaPlugin):
|
|
|
95
95
|
else: # managed by Rucio, create a metadata table if it doesn't exist
|
|
96
96
|
self._try_create_metadata_table()
|
|
97
97
|
|
|
98
|
-
self.
|
|
98
|
+
self._plugin_name = "POSTGRES_JSON"
|
|
99
99
|
|
|
100
100
|
def _try_create_metadata_table(self):
|
|
101
101
|
"""
|
|
@@ -260,17 +260,19 @@ class ExternalPostgresJSONDidMeta(DidMetaPlugin):
|
|
|
260
260
|
|
|
261
261
|
def delete_metadata(self, scope, name, key, *, session: "Optional[Session]" = None):
|
|
262
262
|
"""
|
|
263
|
-
Delete a key from metadata.
|
|
263
|
+
Delete a key from metadata of DID.
|
|
264
264
|
|
|
265
265
|
:param scope: the scope of DID
|
|
266
266
|
:param name: the name of the DID
|
|
267
267
|
:param key: the key to be deleted
|
|
268
268
|
:param session: the database session in use
|
|
269
269
|
"""
|
|
270
|
-
statement = sql.SQL("UPDATE {} SET data = {}.data - {}").format(
|
|
270
|
+
statement = sql.SQL("UPDATE {} SET data = {}.data - {} WHERE scope = {} AND name = {}").format(
|
|
271
271
|
sql.Identifier(self.table),
|
|
272
272
|
sql.Identifier(self.table),
|
|
273
|
-
sql.Literal(key)
|
|
273
|
+
sql.Literal(key),
|
|
274
|
+
sql.Literal(scope.internal),
|
|
275
|
+
sql.Literal(name)
|
|
274
276
|
)
|
|
275
277
|
|
|
276
278
|
cur = self.client.cursor()
|
|
@@ -306,7 +308,7 @@ class ExternalPostgresJSONDidMeta(DidMetaPlugin):
|
|
|
306
308
|
# TODO: possible, but requires retrieving the results of a concurrent sqla query to call list_content
|
|
307
309
|
# on for datasets and containers
|
|
308
310
|
raise exception.UnsupportedOperation(
|
|
309
|
-
"'{}' metadata module does not currently support recursive searches".format(self.
|
|
311
|
+
"'{}' metadata module does not currently support recursive searches".format(self.name)
|
|
310
312
|
)
|
|
311
313
|
|
|
312
314
|
statement = sql.SQL("SELECT * FROM {} WHERE {} {}").format(
|
|
@@ -341,12 +343,3 @@ class ExternalPostgresJSONDidMeta(DidMetaPlugin):
|
|
|
341
343
|
|
|
342
344
|
def manages_key(self, key, *, session: "Optional[Session]" = None):
|
|
343
345
|
return True
|
|
344
|
-
|
|
345
|
-
def get_plugin_name(self):
|
|
346
|
-
"""
|
|
347
|
-
Returns a unique identifier for this plugin. This can be later used for filtering down results to this
|
|
348
|
-
plugin only.
|
|
349
|
-
|
|
350
|
-
:returns: The name of the plugin
|
|
351
|
-
"""
|
|
352
|
-
return self.plugin_name
|
rucio/core/dirac.py
CHANGED
|
@@ -99,7 +99,7 @@ def add_files(
|
|
|
99
99
|
# The list of scopes is necessary for the extract_scope
|
|
100
100
|
filter_ = {'scope': InternalScope(scope='*', vo=vo)}
|
|
101
101
|
scopes = list_scopes(filter_=filter_, session=session)
|
|
102
|
-
scopes = [scope.external for scope in scopes]
|
|
102
|
+
scopes = [scope['scope'].external for scope in scopes]
|
|
103
103
|
exist_lfn = []
|
|
104
104
|
try:
|
|
105
105
|
config_lifetime: str = config_get(section='dirac', option='lifetime', default='{}', session=session)
|
rucio/core/opendata.py
CHANGED
|
@@ -21,10 +21,14 @@ from sqlalchemy.exc import DataError, IntegrityError
|
|
|
21
21
|
from sqlalchemy.sql.expression import bindparam, select
|
|
22
22
|
|
|
23
23
|
from rucio.common import exception
|
|
24
|
+
from rucio.common.config import config_get, config_get_bool, config_get_int
|
|
25
|
+
from rucio.common.constants import DEFAULT_VO
|
|
24
26
|
from rucio.common.exception import OpenDataError, OpenDataInvalidStateUpdate
|
|
27
|
+
from rucio.common.types import InternalAccount
|
|
25
28
|
from rucio.core.did import list_files
|
|
26
29
|
from rucio.core.monitor import MetricManager
|
|
27
30
|
from rucio.core.replica import list_replicas
|
|
31
|
+
from rucio.core.rule import add_rule
|
|
28
32
|
from rucio.db.sqla import models
|
|
29
33
|
from rucio.db.sqla.constants import DIDType, OpenDataDIDState
|
|
30
34
|
|
|
@@ -300,6 +304,7 @@ def get_opendata_did(
|
|
|
300
304
|
include_files: bool = True,
|
|
301
305
|
include_metadata: bool = False,
|
|
302
306
|
include_doi: bool = True,
|
|
307
|
+
include_rule: bool = True,
|
|
303
308
|
session: "Session",
|
|
304
309
|
) -> dict[str, Any]:
|
|
305
310
|
"""
|
|
@@ -312,10 +317,11 @@ def get_opendata_did(
|
|
|
312
317
|
include_files: If True, include a list of associated files. Defaults to True.
|
|
313
318
|
include_metadata: If True, include extended metadata. Defaults to False.
|
|
314
319
|
include_doi: If True, include DOI (Digital Object Identifier) information. Defaults to True.
|
|
320
|
+
include_rule: If True, include the Opendata replication rule. Defaults to True.
|
|
315
321
|
session: SQLAlchemy session to use for the query.
|
|
316
322
|
|
|
317
323
|
Returns:
|
|
318
|
-
A dictionary containing
|
|
324
|
+
A dictionary containing info about the specified DID which include "scope", "name", "state", "meta" (if requested), etc.
|
|
319
325
|
"""
|
|
320
326
|
|
|
321
327
|
query = select(
|
|
@@ -345,6 +351,8 @@ def get_opendata_did(
|
|
|
345
351
|
result["doi"] = get_opendata_doi(scope=scope, name=name, session=session)
|
|
346
352
|
if include_metadata:
|
|
347
353
|
result["meta"] = get_opendata_meta(scope=scope, name=name, session=session)
|
|
354
|
+
if include_rule:
|
|
355
|
+
result["rule"] = _fetch_opendata_rule(scope=scope, name=name, session=session)
|
|
348
356
|
if include_files:
|
|
349
357
|
opendata_files = get_opendata_did_files(scope=scope, name=name, session=session)
|
|
350
358
|
result["files"] = opendata_files
|
|
@@ -508,7 +516,7 @@ def update_opendata_did(
|
|
|
508
516
|
meta: Optional[Union[dict, str]] = None,
|
|
509
517
|
doi: Optional[str] = None,
|
|
510
518
|
session: "Session",
|
|
511
|
-
) ->
|
|
519
|
+
) -> dict[str, Any]:
|
|
512
520
|
"""
|
|
513
521
|
Update an existing Opendata DID in the catalog.
|
|
514
522
|
|
|
@@ -520,6 +528,9 @@ def update_opendata_did(
|
|
|
520
528
|
doi: DOI to associate with the DID. Must be a valid DOI string (e.g., "10.1234/foo.bar").
|
|
521
529
|
session: SQLAlchemy session to use for the operation.
|
|
522
530
|
|
|
531
|
+
Returns:
|
|
532
|
+
A dictionary containing the scope and name of the DID and details of the updates performed. (e.g., new/old state, new/old DOI, etc.)
|
|
533
|
+
|
|
523
534
|
Raises:
|
|
524
535
|
InputValidationError: If none of 'state', 'meta', or 'doi' are provided, or if the provided data is invalid.
|
|
525
536
|
OpenDataDataIdentifierNotFound: If the Opendata DID does not exist.
|
|
@@ -533,14 +544,18 @@ def update_opendata_did(
|
|
|
533
544
|
if not _check_opendata_did_exists(scope=scope, name=name, session=session):
|
|
534
545
|
raise exception.OpenDataDataIdentifierNotFound(f"OpenData DID '{scope}:{name}' not found.")
|
|
535
546
|
|
|
547
|
+
result = {}
|
|
548
|
+
|
|
536
549
|
if state is not None:
|
|
537
|
-
update_opendata_state(scope=scope, name=name, state=state, session=session)
|
|
550
|
+
result |= update_opendata_state(scope=scope, name=name, state=state, session=session)
|
|
538
551
|
|
|
539
552
|
if meta is not None:
|
|
540
|
-
update_opendata_meta(scope=scope, name=name, meta=meta, session=session)
|
|
553
|
+
result |= update_opendata_meta(scope=scope, name=name, meta=meta, session=session)
|
|
541
554
|
|
|
542
555
|
if doi is not None:
|
|
543
|
-
update_opendata_doi(scope=scope, name=name, doi=doi, session=session)
|
|
556
|
+
result |= update_opendata_doi(scope=scope, name=name, doi=doi, session=session)
|
|
557
|
+
|
|
558
|
+
return result
|
|
544
559
|
|
|
545
560
|
|
|
546
561
|
def update_opendata_meta(
|
|
@@ -549,7 +564,7 @@ def update_opendata_meta(
|
|
|
549
564
|
name: str,
|
|
550
565
|
meta: Union[dict, str],
|
|
551
566
|
session: "Session",
|
|
552
|
-
) ->
|
|
567
|
+
) -> dict[str, Any]:
|
|
553
568
|
"""
|
|
554
569
|
Update the metadata associated with an Opendata DID.
|
|
555
570
|
|
|
@@ -559,6 +574,9 @@ def update_opendata_meta(
|
|
|
559
574
|
meta: Metadata to update for the DID. Must be a valid JSON object or string.
|
|
560
575
|
session: SQLAlchemy session to use for the operation.
|
|
561
576
|
|
|
577
|
+
Returns:
|
|
578
|
+
A dictionary containing the scope, name, and updated metadata of the Opendata DID.
|
|
579
|
+
|
|
562
580
|
Raises:
|
|
563
581
|
InputValidationError: If 'meta' is not a dictionary or a valid JSON string.
|
|
564
582
|
OpenDataDataIdentifierNotFound: If the Opendata DID does not exist.
|
|
@@ -598,6 +616,93 @@ def update_opendata_meta(
|
|
|
598
616
|
except DataError as error:
|
|
599
617
|
raise exception.InputValidationError(f"Invalid data: {error}")
|
|
600
618
|
|
|
619
|
+
return {"scope": scope, "name": name, "meta_new": meta}
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
def _fetch_opendata_rule(scope: "InternalScope",
|
|
623
|
+
name: str,
|
|
624
|
+
session: "Session"
|
|
625
|
+
) -> Optional[str]:
|
|
626
|
+
"""
|
|
627
|
+
Retrieves the replication rule ID associated with an Opendata DID, if it exists.
|
|
628
|
+
The rule is searched for in the rules table by matching the scope, name, account (root), rse_expression,
|
|
629
|
+
and copies (1) based on the configuration used for creating the rule.
|
|
630
|
+
|
|
631
|
+
Parameters:
|
|
632
|
+
scope: The scope under which the Opendata DID is registered.
|
|
633
|
+
name: The name of the Opendata DID.
|
|
634
|
+
session: SQLAlchemy session to use for the query.
|
|
635
|
+
Returns:
|
|
636
|
+
The replication rule ID if it exists, otherwise None.
|
|
637
|
+
"""
|
|
638
|
+
|
|
639
|
+
rule_rse_expression = config_get("opendata", "rule_rse_expression", raise_exception=False, default=None)
|
|
640
|
+
if not rule_rse_expression:
|
|
641
|
+
return None
|
|
642
|
+
|
|
643
|
+
rule_account = config_get("opendata", "rule_account", raise_exception=False, default="root")
|
|
644
|
+
rule_vo = config_get("opendata", "rule_vo", raise_exception=False, default=DEFAULT_VO)
|
|
645
|
+
rule_copies = config_get_int("opendata", "rule_copies", raise_exception=False, default=1)
|
|
646
|
+
|
|
647
|
+
return session.execute(
|
|
648
|
+
select(models.ReplicationRule.id).where(
|
|
649
|
+
and_(
|
|
650
|
+
models.ReplicationRule.scope == scope,
|
|
651
|
+
models.ReplicationRule.name == name,
|
|
652
|
+
models.ReplicationRule.account == InternalAccount(account=rule_account, vo=rule_vo),
|
|
653
|
+
models.ReplicationRule.rse_expression == rule_rse_expression,
|
|
654
|
+
models.ReplicationRule.copies == rule_copies,
|
|
655
|
+
)
|
|
656
|
+
)
|
|
657
|
+
).scalar()
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
def _add_opendata_rule(
|
|
661
|
+
scope: "InternalScope",
|
|
662
|
+
name: str,
|
|
663
|
+
session: "Session"
|
|
664
|
+
) -> str:
|
|
665
|
+
"""
|
|
666
|
+
Create a replication rule for an Opendata DID.
|
|
667
|
+
The rule is created with parameters defined in the configuration file under the [opendata] section.
|
|
668
|
+
|
|
669
|
+
Parameters:
|
|
670
|
+
scope: The scope under which the Opendata DID is registered.
|
|
671
|
+
name: The name of the Opendata DID.
|
|
672
|
+
session: SQLAlchemy session to use for the operation.
|
|
673
|
+
Returns:
|
|
674
|
+
The ID of the created replication rule.
|
|
675
|
+
Raises:
|
|
676
|
+
ValueError: If there is an error during the rule creation process.
|
|
677
|
+
"""
|
|
678
|
+
|
|
679
|
+
rule_asynchronous = config_get_bool("opendata", "rule_asynchronous", raise_exception=False, default=False)
|
|
680
|
+
rule_activity = config_get("opendata", "rule_activity", raise_exception=False, default=None)
|
|
681
|
+
rule_rse_expression = config_get("opendata", "rule_rse_expression", raise_exception=True)
|
|
682
|
+
rule_account = config_get("opendata", "rule_account", raise_exception=False, default="root")
|
|
683
|
+
rule_vo = config_get("opendata", "rule_vo", raise_exception=False, default=DEFAULT_VO)
|
|
684
|
+
rule_copies = config_get_int("opendata", "rule_copies", raise_exception=False, default=1)
|
|
685
|
+
|
|
686
|
+
add_rule_result = add_rule(
|
|
687
|
+
dids=[{"scope": scope, "name": name}],
|
|
688
|
+
# We need an account, perhaps we should pass the issuer argument around like in other methods with account
|
|
689
|
+
account=InternalAccount(account=rule_account, vo=rule_vo),
|
|
690
|
+
copies=rule_copies,
|
|
691
|
+
rse_expression=rule_rse_expression,
|
|
692
|
+
grouping="DATASET",
|
|
693
|
+
weight=None,
|
|
694
|
+
lifetime=None,
|
|
695
|
+
locked=False,
|
|
696
|
+
subscription_id=None,
|
|
697
|
+
activity=rule_activity,
|
|
698
|
+
asynchronous=rule_asynchronous,
|
|
699
|
+
session=session,
|
|
700
|
+
)
|
|
701
|
+
if len(add_rule_result) != 1:
|
|
702
|
+
raise ValueError(f"Error adding Open Data rule: {add_rule_result}")
|
|
703
|
+
|
|
704
|
+
return add_rule_result[0]
|
|
705
|
+
|
|
601
706
|
|
|
602
707
|
def update_opendata_state(
|
|
603
708
|
*,
|
|
@@ -605,9 +710,10 @@ def update_opendata_state(
|
|
|
605
710
|
name: str,
|
|
606
711
|
state: OpenDataDIDState,
|
|
607
712
|
session: "Session",
|
|
608
|
-
) ->
|
|
713
|
+
) -> dict[str, Any]:
|
|
609
714
|
"""
|
|
610
715
|
Update the state of an Opendata DID.
|
|
716
|
+
If the new state is PUBLIC, a replication rule may be created based on configuration.
|
|
611
717
|
|
|
612
718
|
Parameters:
|
|
613
719
|
scope: The scope under which the Opendata DID is registered.
|
|
@@ -615,6 +721,9 @@ def update_opendata_state(
|
|
|
615
721
|
state: The new state to set for the Opendata DID.
|
|
616
722
|
session: SQLAlchemy session to use for the operation.
|
|
617
723
|
|
|
724
|
+
Returns:
|
|
725
|
+
A dictionary with the scope and name of the DID and the rule id if a rule was created and the old and new state.
|
|
726
|
+
|
|
618
727
|
Raises:
|
|
619
728
|
InputValidationError: If the provided state is not a valid OpenDataDIDState.
|
|
620
729
|
OpenDataDataIdentifierNotFound: If the Opendata DID does not exist.
|
|
@@ -676,15 +785,30 @@ def update_opendata_state(
|
|
|
676
785
|
if state_before == OpenDataDIDState.DRAFT:
|
|
677
786
|
raise OpenDataInvalidStateUpdate("Cannot set state to SUSPENDED from DRAFT. First set it to PUBLIC.")
|
|
678
787
|
|
|
788
|
+
output = {"scope": scope, "name": name, "state_old": state_before, "state_new": state}
|
|
789
|
+
|
|
679
790
|
try:
|
|
680
791
|
result = session.execute(update_query)
|
|
681
792
|
|
|
682
793
|
if result.rowcount == 0:
|
|
683
794
|
raise ValueError(f"Error updating Opendata state for DID '{scope}:{name}'.")
|
|
684
795
|
|
|
796
|
+
if state == OpenDataDIDState.PUBLIC:
|
|
797
|
+
rule_enable = config_get_bool("opendata", "rule_enable", raise_exception=False, default=False)
|
|
798
|
+
if rule_enable:
|
|
799
|
+
rule_id = _fetch_opendata_rule(scope=scope, name=name, session=session)
|
|
800
|
+
if rule_id:
|
|
801
|
+
output["rule"] = rule_id
|
|
802
|
+
output["comments"] = "Replication rule already exists"
|
|
803
|
+
else:
|
|
804
|
+
output["rule"] = _add_opendata_rule(scope=scope, name=name, session=session)
|
|
805
|
+
output["comments"] = "Replication rule created"
|
|
806
|
+
|
|
685
807
|
except DataError as error:
|
|
686
808
|
raise exception.InputValidationError(f"Invalid data: {error}")
|
|
687
809
|
|
|
810
|
+
return output
|
|
811
|
+
|
|
688
812
|
|
|
689
813
|
def update_opendata_doi(
|
|
690
814
|
*,
|
|
@@ -692,7 +816,7 @@ def update_opendata_doi(
|
|
|
692
816
|
name: str,
|
|
693
817
|
doi: str,
|
|
694
818
|
session: "Session",
|
|
695
|
-
) ->
|
|
819
|
+
) -> dict[str, Any]:
|
|
696
820
|
"""
|
|
697
821
|
Update the DOI (Digital Object Identifier) associated with an Opendata DID.
|
|
698
822
|
|
|
@@ -702,6 +826,9 @@ def update_opendata_doi(
|
|
|
702
826
|
doi: The new DOI to associate with the Opendata DID. Must be a valid DOI string.
|
|
703
827
|
session: SQLAlchemy session to use for the operation.
|
|
704
828
|
|
|
829
|
+
Returns:
|
|
830
|
+
A dictionary containing the scope, name, new DOI, and previous DOI of the Opendata DID.
|
|
831
|
+
|
|
705
832
|
Raises:
|
|
706
833
|
InputValidationError: If the provided DOI is not a valid string or does not match the expected format.
|
|
707
834
|
OpenDataDataIdentifierNotFound: If the Opendata DID does not exist.
|
|
@@ -740,5 +867,20 @@ def update_opendata_doi(
|
|
|
740
867
|
if result.rowcount == 0:
|
|
741
868
|
raise ValueError(f"Error updating Opendata DOI for DID '{scope}:{name}'.")
|
|
742
869
|
|
|
870
|
+
except IntegrityError as error:
|
|
871
|
+
msg = str(error)
|
|
872
|
+
|
|
873
|
+
if (
|
|
874
|
+
search(r'ORA-00001: unique constraint \([^)]+\) violated', msg)
|
|
875
|
+
or search(r'UNIQUE constraint failed: dids_opendata_doi\.doi', msg)
|
|
876
|
+
or search(r'1062.*Duplicate entry.*for key', msg)
|
|
877
|
+
or search(r'duplicate key value violates unique constraint', msg)
|
|
878
|
+
or search(r'columns?.*not unique', msg)
|
|
879
|
+
):
|
|
880
|
+
raise exception.OpenDataDuplicateDOI(doi=doi)
|
|
881
|
+
|
|
882
|
+
raise exception.OpenDataError()
|
|
743
883
|
except DataError as error:
|
|
744
884
|
raise exception.InputValidationError(f"Invalid data: {error}")
|
|
885
|
+
|
|
886
|
+
return {"scope": scope, "name": name, "doi_new": doi, "doi_old": doi_before}
|
rucio/core/rse.py
CHANGED
|
@@ -824,8 +824,12 @@ def list_rses(filters: Optional[dict[str, Any]] = None, *, session: "Session") -
|
|
|
824
824
|
|
|
825
825
|
for (k, v) in filters.items():
|
|
826
826
|
if hasattr(models.RSE, k):
|
|
827
|
-
|
|
828
|
-
|
|
827
|
+
# API calls always provide str, but some core calls use the right type
|
|
828
|
+
if isinstance(v, str):
|
|
829
|
+
try:
|
|
830
|
+
stmt = stmt.where(getattr(models.RSE, k) == models.RSE.from_str(k, v))
|
|
831
|
+
except ValueError as e:
|
|
832
|
+
raise exception.InvalidObject(*e.args)
|
|
829
833
|
else:
|
|
830
834
|
stmt = stmt.where(getattr(models.RSE, k) == v)
|
|
831
835
|
else:
|
rucio/core/rule_grouping.py
CHANGED
|
@@ -690,7 +690,7 @@ def __repair_stuck_locks_with_none_grouping(datasetfiles, locks, replicas, sourc
|
|
|
690
690
|
associated_replica.lock_cnt = session.execute(stmt).scalar_one()
|
|
691
691
|
continue
|
|
692
692
|
# Check if this is a STUCK lock due to source_replica filtering
|
|
693
|
-
if source_rses:
|
|
693
|
+
if source_rses and not lock.repair_cnt:
|
|
694
694
|
associated_replica = [replica for replica in replicas[(file['scope'], file['name'])] if replica.rse_id == lock.rse_id][0]
|
|
695
695
|
# Check if there is an eligible source replica for this lock
|
|
696
696
|
if set(source_replicas.get((file['scope'], file['name']), [])).intersection(source_rses) and (selector_rse_dict.get(lock.rse_id, {}).get('availability_write', True) or rule.ignore_availability):
|
|
@@ -806,7 +806,7 @@ def __repair_stuck_locks_with_all_grouping(datasetfiles, locks, replicas, source
|
|
|
806
806
|
associated_replica.lock_cnt = session.execute(stmt).scalar_one()
|
|
807
807
|
continue
|
|
808
808
|
# Check if this is a STUCK lock due to source_replica filtering
|
|
809
|
-
if source_rses:
|
|
809
|
+
if source_rses and not lock.repair_cnt:
|
|
810
810
|
associated_replica = [replica for replica in replicas[(file['scope'], file['name'])] if replica.rse_id == lock.rse_id][0]
|
|
811
811
|
# Check if there is an eligible source replica for this lock
|
|
812
812
|
if set(source_replicas.get((file['scope'], file['name']), [])).intersection(source_rses) and (selector_rse_dict.get(lock.rse_id, {}).get('availability_write', True) or rule.ignore_availability):
|
|
@@ -891,7 +891,7 @@ def __repair_stuck_locks_with_dataset_grouping(datasetfiles, locks, replicas, so
|
|
|
891
891
|
associated_replica.lock_cnt = session.execute(stmt).scalar_one()
|
|
892
892
|
continue
|
|
893
893
|
# Check if this is a STUCK lock due to source_replica filtering
|
|
894
|
-
if source_rses:
|
|
894
|
+
if source_rses and not lock.repair_cnt:
|
|
895
895
|
associated_replica = [replica for replica in replicas[(file['scope'], file['name'])] if replica.rse_id == lock.rse_id][0]
|
|
896
896
|
# Check if there is an eligible source replica for this lock
|
|
897
897
|
if set(source_replicas.get((file['scope'], file['name']), [])).intersection(source_rses) and (selector_rse_dict.get(lock.rse_id, {}).get('availability_write', True) or rule.ignore_availability):
|
rucio/core/scope.py
CHANGED
|
@@ -14,21 +14,24 @@
|
|
|
14
14
|
|
|
15
15
|
from re import match
|
|
16
16
|
from traceback import format_exc
|
|
17
|
-
from typing import TYPE_CHECKING, Any, Optional
|
|
17
|
+
from typing import TYPE_CHECKING, Any, Literal, Optional
|
|
18
18
|
|
|
19
|
-
from sqlalchemy import and_, select
|
|
19
|
+
from sqlalchemy import and_, select, update
|
|
20
20
|
from sqlalchemy.exc import IntegrityError
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
import rucio.core.account as account_core
|
|
23
|
+
from rucio.common.exception import AccountNotFound, Duplicate, RucioException, ScopeNotFound, VONotFound
|
|
23
24
|
from rucio.core.vo import vo_exists
|
|
24
25
|
from rucio.db.sqla import models
|
|
25
26
|
from rucio.db.sqla.constants import AccountStatus, ScopeStatus
|
|
26
27
|
from rucio.db.sqla.session import read_session, transactional_session
|
|
27
28
|
|
|
28
29
|
if TYPE_CHECKING:
|
|
30
|
+
from collections.abc import Iterable
|
|
31
|
+
|
|
29
32
|
from sqlalchemy.orm import Session
|
|
30
33
|
|
|
31
|
-
from rucio.common.types import InternalScope
|
|
34
|
+
from rucio.common.types import InternalAccount, InternalScope
|
|
32
35
|
|
|
33
36
|
|
|
34
37
|
@transactional_session
|
|
@@ -87,7 +90,7 @@ def bulk_add_scopes(scopes, account, skip_existing=False, *, session: "Session")
|
|
|
87
90
|
|
|
88
91
|
|
|
89
92
|
@read_session
|
|
90
|
-
def list_scopes(filter_: Optional[dict[str, Any]] = None, *, session: "Session") ->
|
|
93
|
+
def list_scopes(filter_: Optional[dict[str, Any]] = None, *, session: "Session") -> "Iterable[dict[Literal['scope', 'account'], Any]]":
|
|
91
94
|
"""
|
|
92
95
|
Lists all scopes.
|
|
93
96
|
:param filter_: Dictionary of attributes by which the input data should be filtered
|
|
@@ -97,7 +100,8 @@ def list_scopes(filter_: Optional[dict[str, Any]] = None, *, session: "Session")
|
|
|
97
100
|
"""
|
|
98
101
|
filter_ = filter_ or {}
|
|
99
102
|
stmt = select(
|
|
100
|
-
models.Scope.scope
|
|
103
|
+
models.Scope.scope,
|
|
104
|
+
models.Scope.account
|
|
101
105
|
).where(
|
|
102
106
|
models.Scope.status != ScopeStatus.DELETED
|
|
103
107
|
)
|
|
@@ -112,8 +116,14 @@ def list_scopes(filter_: Optional[dict[str, Any]] = None, *, session: "Session")
|
|
|
112
116
|
stmt = stmt.where(
|
|
113
117
|
models.Scope.scope == filter_['scope']
|
|
114
118
|
)
|
|
119
|
+
scopes = []
|
|
120
|
+
for scope, account in session.execute(stmt):
|
|
121
|
+
scopes.append({
|
|
122
|
+
"scope": scope,
|
|
123
|
+
"account": account
|
|
124
|
+
})
|
|
115
125
|
|
|
116
|
-
return
|
|
126
|
+
return scopes
|
|
117
127
|
|
|
118
128
|
|
|
119
129
|
@read_session
|
|
@@ -179,3 +189,33 @@ def is_scope_owner(scope, account, *, session: "Session"):
|
|
|
179
189
|
models.Scope.account == account)
|
|
180
190
|
)
|
|
181
191
|
return bool(session.execute(stmt).scalar())
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
@transactional_session
|
|
195
|
+
def update_scope(scope: "InternalScope", account: "InternalAccount", *, session: "Session") -> None:
|
|
196
|
+
""" Give the scope a new owner
|
|
197
|
+
|
|
198
|
+
:param scope: the name for the existing scope.
|
|
199
|
+
:param account: the account to add the scope to.
|
|
200
|
+
:param session: The database session in use.
|
|
201
|
+
"""
|
|
202
|
+
|
|
203
|
+
if not vo_exists(vo=scope.vo, session=session):
|
|
204
|
+
raise VONotFound('VO {} not found'.format(scope.vo))
|
|
205
|
+
|
|
206
|
+
# Verify both the scope and account exist
|
|
207
|
+
account_core.get_account(account, session=session)
|
|
208
|
+
if not check_scope(scope):
|
|
209
|
+
raise ScopeNotFound
|
|
210
|
+
|
|
211
|
+
stmt = update(
|
|
212
|
+
models.Scope
|
|
213
|
+
).where(
|
|
214
|
+
models.Scope.scope == scope
|
|
215
|
+
).values({
|
|
216
|
+
models.Scope.account: account
|
|
217
|
+
})
|
|
218
|
+
try:
|
|
219
|
+
session.execute(stmt)
|
|
220
|
+
except Exception:
|
|
221
|
+
raise RucioException(str(format_exc()))
|
|
@@ -177,6 +177,8 @@ def run_once(heartbeat_handler: HeartbeatHandler, inputfile: str, **_kwargs) ->
|
|
|
177
177
|
vo = map_vo(client.vo) # type: ignore
|
|
178
178
|
filters = {"scope": InternalScope("*", vo=vo)}
|
|
179
179
|
scopes = list_scopes(filter_=filters)
|
|
180
|
+
if not isinstance(scopes[0], str): # TODO Backwards Compat - Remove in v40, #8125
|
|
181
|
+
scopes = [scope['scope'] for scope in scopes]
|
|
180
182
|
if InternalScope(scope, vo=vo) not in scopes:
|
|
181
183
|
logger(logging.ERROR, "Scope %s does not exist. Exiting", scope)
|
|
182
184
|
return True
|
rucio/db/sqla/models.py
CHANGED
|
@@ -877,6 +877,28 @@ class RSE(BASE, SoftModelBase):
|
|
|
877
877
|
CheckConstraint('RSE_TYPE IS NOT NULL', name='RSES_TYPE_NN'),
|
|
878
878
|
ForeignKeyConstraint(['vo'], ['vos.vo'], name='RSES_VOS_FK'), )
|
|
879
879
|
|
|
880
|
+
@staticmethod
|
|
881
|
+
def from_str(key: str, value: str) -> Any:
|
|
882
|
+
"""Parses str value to key-specific database type."""
|
|
883
|
+
|
|
884
|
+
if key in ['deterministic', 'volatile', 'staging_area', 'availability_read', 'availability_write', 'availability_delete']:
|
|
885
|
+
# boolean types
|
|
886
|
+
if value == '1' or value.casefold() == 'true'.casefold():
|
|
887
|
+
return True
|
|
888
|
+
elif value == '0' or value.casefold() == 'false'.casefold():
|
|
889
|
+
return False
|
|
890
|
+
else:
|
|
891
|
+
raise ValueError(f'Invalid boolean value: {value}')
|
|
892
|
+
|
|
893
|
+
elif key == 'rse_type':
|
|
894
|
+
try:
|
|
895
|
+
return RSEType[value]
|
|
896
|
+
except KeyError:
|
|
897
|
+
raise ValueError(f'Invalid rse_type: {value}')
|
|
898
|
+
|
|
899
|
+
else:
|
|
900
|
+
return value
|
|
901
|
+
|
|
880
902
|
|
|
881
903
|
class RSELimit(BASE, ModelBase):
|
|
882
904
|
"""Represents RSE limits"""
|
rucio/gateway/account.py
CHANGED
|
@@ -14,10 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
from typing import TYPE_CHECKING, Any, Optional
|
|
16
16
|
|
|
17
|
-
import rucio.common.exception
|
|
18
|
-
import rucio.core.identity
|
|
19
17
|
import rucio.gateway.permission
|
|
20
18
|
from rucio.common.constants import DEFAULT_VO
|
|
19
|
+
from rucio.common.exception import AccessDenied, InvalidAccountType
|
|
21
20
|
from rucio.common.schema import validate_schema
|
|
22
21
|
from rucio.common.types import InternalAccount
|
|
23
22
|
from rucio.common.utils import gateway_update_return_dict
|
|
@@ -55,11 +54,13 @@ def add_account(
|
|
|
55
54
|
validate_schema(name='account', obj=account, vo=vo)
|
|
56
55
|
|
|
57
56
|
kwargs = {'account': account, 'type': type_}
|
|
57
|
+
if type_.upper() not in AccountType._member_names_:
|
|
58
|
+
raise InvalidAccountType(f"{type_} is an invalid account type. Choose from {AccountType._member_names_}")
|
|
58
59
|
|
|
59
60
|
with db_session(DatabaseOperationType.WRITE) as session:
|
|
60
61
|
auth_result = rucio.gateway.permission.has_permission(issuer=issuer, vo=vo, action='add_account', kwargs=kwargs, session=session)
|
|
61
62
|
if not auth_result.allowed:
|
|
62
|
-
raise
|
|
63
|
+
raise AccessDenied('Account %s can not add account. %s' % (issuer, auth_result.message))
|
|
63
64
|
|
|
64
65
|
internal_account = InternalAccount(account, vo=vo)
|
|
65
66
|
|
|
@@ -83,7 +84,7 @@ def del_account(
|
|
|
83
84
|
with db_session(DatabaseOperationType.WRITE) as session:
|
|
84
85
|
auth_result = rucio.gateway.permission.has_permission(issuer=issuer, vo=vo, action='del_account', kwargs=kwargs, session=session)
|
|
85
86
|
if not auth_result.allowed:
|
|
86
|
-
raise
|
|
87
|
+
raise AccessDenied('Account %s can not delete account. %s' % (issuer, auth_result.message))
|
|
87
88
|
|
|
88
89
|
internal_account = InternalAccount(account, vo=vo)
|
|
89
90
|
|
|
@@ -132,7 +133,7 @@ def update_account(
|
|
|
132
133
|
with db_session(DatabaseOperationType.WRITE) as session:
|
|
133
134
|
auth_result = rucio.gateway.permission.has_permission(issuer=issuer, vo=vo, action='update_account', kwargs=kwargs, session=session)
|
|
134
135
|
if not auth_result.allowed:
|
|
135
|
-
raise
|
|
136
|
+
raise AccessDenied('Account %s can not change %s of the account. %s' % (issuer, key, auth_result.message))
|
|
136
137
|
|
|
137
138
|
internal_account = InternalAccount(account, vo=vo)
|
|
138
139
|
|
|
@@ -242,7 +243,7 @@ def add_account_attribute(
|
|
|
242
243
|
with db_session(DatabaseOperationType.WRITE) as session:
|
|
243
244
|
auth_result = rucio.gateway.permission.has_permission(issuer=issuer, vo=vo, action='add_attribute', kwargs=kwargs, session=session)
|
|
244
245
|
if not auth_result.allowed:
|
|
245
|
-
raise
|
|
246
|
+
raise AccessDenied('Account %s can not add attributes. %s' % (issuer, auth_result.message))
|
|
246
247
|
|
|
247
248
|
internal_account = InternalAccount(account, vo=vo)
|
|
248
249
|
|
|
@@ -268,7 +269,7 @@ def del_account_attribute(
|
|
|
268
269
|
with db_session(DatabaseOperationType.WRITE) as session:
|
|
269
270
|
auth_result = rucio.gateway.permission.has_permission(issuer=issuer, vo=vo, action='del_attribute', kwargs=kwargs, session=session)
|
|
270
271
|
if not auth_result.allowed:
|
|
271
|
-
raise
|
|
272
|
+
raise AccessDenied('Account %s can not delete attribute. %s' % (issuer, auth_result.message))
|
|
272
273
|
|
|
273
274
|
internal_account = InternalAccount(account, vo=vo)
|
|
274
275
|
|
rucio/gateway/did.py
CHANGED
|
@@ -62,7 +62,7 @@ def list_dids(
|
|
|
62
62
|
if 'account' in or_group:
|
|
63
63
|
or_group['account'] = InternalAccount(or_group['account'], vo=vo)
|
|
64
64
|
if 'scope' in or_group:
|
|
65
|
-
or_group['
|
|
65
|
+
or_group['scope'] = InternalScope(or_group['scope'], vo=vo)
|
|
66
66
|
|
|
67
67
|
with db_session(DatabaseOperationType.READ) as session:
|
|
68
68
|
result = did.list_dids(scope=internal_scope, filters=filters, did_type=did_type, ignore_case=ignore_case,
|
rucio/gateway/dirac.py
CHANGED
|
@@ -52,7 +52,7 @@ def add_files(
|
|
|
52
52
|
|
|
53
53
|
with db_session(DatabaseOperationType.WRITE) as session:
|
|
54
54
|
filter_ = {'scope': InternalScope(scope='*', vo=vo)}
|
|
55
|
-
scopes = [scope.external for scope in list_scopes(filter_=filter_, session=session)]
|
|
55
|
+
scopes = [scope['scope'].external for scope in list_scopes(filter_=filter_, session=session)]
|
|
56
56
|
dids = []
|
|
57
57
|
rses = {}
|
|
58
58
|
for lfn in lfns:
|