Skip to content

Commit

Permalink
Policies: refactor policy package code to use new plugin code #6382
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesp-epcc authored and bari12 committed Mar 11, 2024
1 parent 5bb7ade commit 57955a0
Show file tree
Hide file tree
Showing 5 changed files with 321 additions and 314 deletions.
6 changes: 4 additions & 2 deletions lib/rucio/core/plugins.py → lib/rucio/common/plugins.py
Expand Up @@ -20,8 +20,6 @@

from rucio.common import config
from rucio.common.exception import InvalidAlgorithmName
from rucio.common.utils import check_policy_package_version
from rucio.core.vo import list_vos


PolicyPackageAlgorithmsT = TypeVar('PolicyPackageAlgorithmsT', bound='PolicyPackageAlgorithms')
Expand Down Expand Up @@ -114,6 +112,7 @@ def _register_all_policy_package_algorithms(cls: Type[PolicyPackageAlgorithmsT])
cls._try_importing_policy(vo)
# on server, list all VOs and register their algorithms
else:
from rucio.core.vo import list_vos
# policy package per VO
vos = list_vos()
for vo in vos:
Expand All @@ -122,6 +121,9 @@ def _register_all_policy_package_algorithms(cls: Type[PolicyPackageAlgorithmsT])
@classmethod
def _try_importing_policy(cls: Type[PolicyPackageAlgorithmsT], vo: str = "") -> None:
try:
# import from utils here to avoid circular import
from rucio.common.utils import check_policy_package_version

env_name = 'RUCIO_POLICY_PACKAGE' + ('' if not vo else '_' + vo.upper())
package = getattr(os.environ, env_name, "")
if not package:
Expand Down

0 comments on commit 57955a0

Please sign in to comment.