diracx-cli 0.0.1a44__py3-none-any.whl → 0.0.1a45__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.
@@ -24,14 +24,27 @@ from ..utils import AsyncTyper
24
24
  app = AsyncTyper()
25
25
 
26
26
 
27
+ def get_repo_path(config_repo_str: str) -> Path:
28
+ config_repo = TypeAdapter(ConfigSourceUrl).validate_python(config_repo_str)
29
+ if config_repo.scheme != "git+file" or config_repo.path is None:
30
+ raise NotImplementedError("Only git+file:// URLs are supported")
31
+
32
+ repo_path = Path(config_repo.path)
33
+
34
+ return repo_path
35
+
36
+
37
+ def get_config_from_repo_path(repo_path: Path) -> Config:
38
+ return ConfigSource.create_from_url(backend_url=repo_path).read_config()
39
+
40
+
27
41
  @app.command()
28
42
  def generate_cs(config_repo: str):
29
43
  """Generate a minimal DiracX configuration repository."""
30
44
  # TODO: The use of TypeAdapter should be moved in to typer itself
31
- config_repo = TypeAdapter(ConfigSourceUrl).validate_python(config_repo)
32
- if config_repo.scheme != "git+file" or config_repo.path is None:
33
- raise NotImplementedError("Only git+file:// URLs are supported")
34
- repo_path = Path(config_repo.path)
45
+
46
+ repo_path = get_repo_path(config_repo)
47
+
35
48
  if repo_path.exists() and list(repo_path.iterdir()):
36
49
  typer.echo(f"ERROR: Directory {repo_path} already exists", err=True)
37
50
  raise typer.Exit(1)
@@ -60,10 +73,8 @@ def add_vo(
60
73
  ):
61
74
  """Add a registry entry (vo) to an existing configuration repository."""
62
75
  # TODO: The use of TypeAdapter should be moved in to typer itself
63
- config_repo = TypeAdapter(ConfigSourceUrl).validate_python(config_repo)
64
- if config_repo.scheme != "git+file" or config_repo.path is None:
65
- raise NotImplementedError("Only git+file:// URLs are supported")
66
- repo_path = Path(config_repo.path)
76
+ repo_path = get_repo_path(config_repo)
77
+ config = get_config_from_repo_path(repo_path)
67
78
 
68
79
  # A VO should at least contain a default group
69
80
  new_registry = RegistryConfig(
@@ -77,8 +88,6 @@ def add_vo(
77
88
  },
78
89
  )
79
90
 
80
- config = ConfigSource.create_from_url(backend_url=repo_path).read_config()
81
-
82
91
  if vo in config.Registry:
83
92
  typer.echo(f"ERROR: VO {vo} already exists", err=True)
84
93
  raise typer.Exit(1)
@@ -103,15 +112,11 @@ def add_group(
103
112
  ):
104
113
  """Add a group to an existing vo in the configuration repository."""
105
114
  # TODO: The use of TypeAdapter should be moved in to typer itself
106
- config_repo = TypeAdapter(ConfigSourceUrl).validate_python(config_repo)
107
- if config_repo.scheme != "git+file" or config_repo.path is None:
108
- raise NotImplementedError("Only git+file:// URLs are supported")
109
- repo_path = Path(config_repo.path)
115
+ repo_path = get_repo_path(config_repo)
116
+ config = get_config_from_repo_path(repo_path)
110
117
 
111
118
  new_group = GroupConfig(Properties=set(properties), Quota=None, Users=set())
112
119
 
113
- config = ConfigSource.create_from_url(backend_url=repo_path).read_config()
114
-
115
120
  if vo not in config.Registry:
116
121
  typer.echo(f"ERROR: Virtual Organization {vo} does not exist", err=True)
117
122
  raise typer.Exit(1)
@@ -139,16 +144,11 @@ def add_user(
139
144
  ):
140
145
  """Add a user to an existing vo and group."""
141
146
  # TODO: The use of TypeAdapter should be moved in to typer itself
142
- config_repo = TypeAdapter(ConfigSourceUrl).validate_python(config_repo)
143
- if config_repo.scheme != "git+file" or config_repo.path is None:
144
- raise NotImplementedError("Only git+file:// URLs are supported")
145
-
146
- repo_path = Path(config_repo.path)
147
+ repo_path = get_repo_path(config_repo)
148
+ config = get_config_from_repo_path(repo_path)
147
149
 
148
150
  new_user = UserConfig(PreferedUsername=preferred_username)
149
151
 
150
- config = ConfigSource.create_from_url(backend_url=repo_path).read_config()
151
-
152
152
  if vo not in config.Registry:
153
153
  typer.echo(f"ERROR: Virtual Organization {vo} does not exist", err=True)
154
154
  raise typer.Exit(1)
@@ -96,7 +96,7 @@ def _apply_fixes(raw):
96
96
  raw["DIRAC"].pop("Framework", None)
97
97
  raw["DIRAC"].pop("Security", None)
98
98
 
99
- # This is VOMS specific and no longer reqired
99
+ # This is VOMS specific and no longer required
100
100
  raw["DIRAC"].pop("ConnConf", None)
101
101
 
102
102
  # Setups are no longer supported
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diracx-cli
3
- Version: 0.0.1a44
3
+ Version: 0.0.1a45
4
4
  Summary: TODO
5
5
  License: GPL-3.0-only
6
6
  Classifier: Intended Audience :: Science/Research
@@ -9,17 +9,16 @@ Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Topic :: Scientific/Engineering
10
10
  Classifier: Topic :: System :: Distributed Computing
11
11
  Requires-Python: >=3.11
12
- Description-Content-Type: text/markdown
13
12
  Requires-Dist: diraccfg
14
13
  Requires-Dist: diracx-api
15
14
  Requires-Dist: diracx-client
16
15
  Requires-Dist: diracx-core
17
16
  Requires-Dist: gitpython
18
17
  Requires-Dist: pydantic>=2.10
18
+ Requires-Dist: pyyaml
19
19
  Requires-Dist: rich
20
20
  Requires-Dist: typer>=0.12.4
21
- Requires-Dist: pyyaml
22
21
  Provides-Extra: testing
23
- Requires-Dist: diracx-testing; extra == "testing"
22
+ Requires-Dist: diracx-testing; extra == 'testing'
24
23
  Provides-Extra: types
25
- Requires-Dist: types-PyYAML; extra == "types"
24
+ Requires-Dist: types-pyyaml; extra == 'types'
@@ -6,10 +6,9 @@ diracx/cli/jobs.py,sha256=ev3Zm6WH9g5MVT5EXbfSwHamiQUcatT4bYUrxx4c8BE,4729
6
6
  diracx/cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  diracx/cli/utils.py,sha256=--kP1lOO4yky81nxmej8IQz1v6njxn_WYol5O9LcJ04,1063
8
8
  diracx/cli/internal/__init__.py,sha256=KZrzVcKu3YhNev2XF2KA2nttAa9ONU3CVUgatVMonJ4,143
9
- diracx/cli/internal/config.py,sha256=xPT7lnJ3QPqJgaNJuMoUpV6CIIxZY_d7HKFb4uINb_8,6552
10
- diracx/cli/internal/legacy.py,sha256=Wzfdgjbt9xxUK6MkCrEGNXdMOJzkvUGJh2MnD2j_2QE,13547
11
- diracx_cli-0.0.1a44.dist-info/METADATA,sha256=1-AlfHq1Tda7gHsV_KWeTejzYjkEH5akA8myzGP9hiE,803
12
- diracx_cli-0.0.1a44.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
13
- diracx_cli-0.0.1a44.dist-info/entry_points.txt,sha256=b1909GHVOkFUiHVglNlpwia4Ug-7Ncrg-8D5xtYVAlw,169
14
- diracx_cli-0.0.1a44.dist-info/top_level.txt,sha256=vJx10tdRlBX3rF2Psgk5jlwVGZNcL3m_7iQWwgPXt-U,7
15
- diracx_cli-0.0.1a44.dist-info/RECORD,,
9
+ diracx/cli/internal/config.py,sha256=T5bf9brG1oCQkQ6D7Em4z7Fk--2Q-nPtUbe2jv-syUU,6079
10
+ diracx/cli/internal/legacy.py,sha256=zfdqO-ydFSkio2CTIcHXlObAwhBq25WNZgdChkdZ1LE,13548
11
+ diracx_cli-0.0.1a45.dist-info/METADATA,sha256=EWz-8JC4mvAfdgsyYZ7d3939eQ0jRi87TTrz6n5CP_A,763
12
+ diracx_cli-0.0.1a45.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
+ diracx_cli-0.0.1a45.dist-info/entry_points.txt,sha256=b1909GHVOkFUiHVglNlpwia4Ug-7Ncrg-8D5xtYVAlw,169
14
+ diracx_cli-0.0.1a45.dist-info/RECORD,,
@@ -1,5 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.0.0)
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
-
@@ -1 +0,0 @@
1
- diracx