opentf-toolkit-nightly 0.60.0.dev1227__py3-none-any.whl → 0.60.0.dev1230__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.
@@ -29,8 +29,12 @@ from flask import Flask, current_app, make_response, request, g, Response
29
29
 
30
30
  from toposort import toposort, CircularDependencyError
31
31
 
32
+ from .auth import (
33
+ initialize_authn_authz,
34
+ get_user_accessible_namespaces,
35
+ is_user_authorized,
36
+ )
32
37
  from .config import (
33
- ConfigError,
34
38
  make_argparser,
35
39
  configure_logging,
36
40
  read_config,
@@ -38,11 +42,7 @@ from .config import (
38
42
  get_named,
39
43
  get_debug_level,
40
44
  )
41
- from .auth import (
42
- initialize_authn_authz,
43
- get_user_accessible_namespaces,
44
- is_user_authorized,
45
- )
45
+ from .exceptions import ConfigError
46
46
  from .pubsub import make_dispatchqueue, make_event, publish, subscribe, unsubscribe
47
47
  from .schemas import *
48
48
 
opentf/commons/config.py CHANGED
@@ -24,6 +24,7 @@ from logging.config import dictConfig
24
24
 
25
25
  import yaml
26
26
 
27
+ from .exceptions import ConfigError
27
28
  from .schemas import validate_schema, SERVICECONFIG
28
29
 
29
30
 
@@ -44,10 +45,6 @@ DEBUG_LEVELS = {'CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'NOTSET'}
44
45
  ########################################################################
45
46
 
46
47
 
47
- class ConfigError(Exception):
48
- """Invalid configuration file."""
49
-
50
-
51
48
  def make_argparser(description: str, configfile: str) -> argparse.ArgumentParser:
52
49
  parser = argparse.ArgumentParser(description=description)
53
50
  parser.add_argument('--descriptor', help='alternate descriptor file')
@@ -18,9 +18,9 @@ from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union
18
18
 
19
19
  from datetime import datetime
20
20
 
21
-
22
21
  from flask import current_app
23
22
 
23
+ from opentf.commons.exceptions import ServiceError
24
24
  from opentf.commons.expressions import evaluate_bool
25
25
  from opentf.commons.selectors import match_selectors
26
26
 
@@ -49,21 +49,13 @@ CREATION_TIMESTAMP = 'creationTimestamp'
49
49
  ## Helpers
50
50
 
51
51
 
52
- class DataSourceScopeError(Exception):
52
+ class DataSourceScopeError(ServiceError):
53
53
  """DataSourceScopeError class"""
54
54
 
55
- def __init__(self, msg, details=None):
56
- self.msg = msg
57
- self.details = details
58
-
59
55
 
60
- class DataSourceDataError(Exception):
56
+ class DataSourceDataError(ServiceError):
61
57
  """DataSourceDataError class"""
62
58
 
63
- def __init__(self, msg, details=None):
64
- self.msg = msg
65
- self.details = details
66
-
67
59
 
68
60
  def _merge_dicts(dict1: Dict[str, Any], dict2: Dict[str, Any]) -> Dict[str, Any]:
69
61
  for k, v in dict1.items():
@@ -0,0 +1,108 @@
1
+ # Copyright (c) 2024 Henix, Henix.fr
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """Helpers for the OpenTestFactory orchestrator exceptions.
16
+
17
+ ```plaintext
18
+ OpentfError
19
+ |- ConfigError
20
+ |- ServiceError
21
+ | |- AlreadyExistsError
22
+ | |- BadRequestError
23
+ | |- ConflictError
24
+ | |- InvalidRequestError
25
+ | |- NotFoundError
26
+ | |- UnauthorizedError
27
+ |- ExecutionError
28
+ ```
29
+ """
30
+
31
+
32
+ class OpentfError(Exception):
33
+ """Base orchestrator exceptions."""
34
+
35
+
36
+ class ConfigError(OpentfError):
37
+ """Invalid configuration file."""
38
+
39
+
40
+ class ServiceError(OpentfError):
41
+ """Base exception for request errors."""
42
+
43
+ status_name = 'ServiceError'
44
+
45
+ def __init__(self, msg, details=None):
46
+ self.msg = msg
47
+ self.details = details
48
+
49
+ @property
50
+ def http_status_name(self):
51
+ return self.status_name
52
+
53
+
54
+ class AlreadyExistsError(ServiceError):
55
+ """AlreadyExists exception."""
56
+
57
+ status_name = 'AlreadyExists'
58
+
59
+
60
+ class BadRequestError(ServiceError):
61
+ """BadRequest exception."""
62
+
63
+ status_name = 'BadRequest'
64
+
65
+
66
+ class ConflictError(ServiceError):
67
+ """Invalid exception."""
68
+
69
+ status_name = 'Conflict'
70
+
71
+
72
+ class InvalidRequestError(ServiceError):
73
+ """Invalid exception."""
74
+
75
+ status_name = 'Invalid'
76
+
77
+
78
+ class NotFoundError(ServiceError):
79
+ """NotFound exception."""
80
+
81
+ status_name = 'NotFound'
82
+
83
+
84
+ class UnauthorizedError(ServiceError):
85
+ """Invalid exception."""
86
+
87
+ status_name = 'Unauthorized'
88
+
89
+
90
+ ########################################################################
91
+ ## Exception helpers
92
+
93
+
94
+ class ExecutionError(OpentfError):
95
+ """An ExecutionError exception.
96
+
97
+ Only expected to be raised in a workflow thread. Will publish
98
+ the corresponding ExecutionError event if in this context.
99
+ """
100
+
101
+ def __init__(self, *args):
102
+ if args:
103
+ self.message = args[0]
104
+ else:
105
+ self.message = None
106
+
107
+ def __str__(self):
108
+ return str(self.message)
opentf/toolkit/core.py CHANGED
@@ -30,6 +30,7 @@ from opentf.commons import (
30
30
  make_event,
31
31
  make_uuid,
32
32
  )
33
+ from opentf.commons.exceptions import ExecutionError
33
34
 
34
35
 
35
36
  ########################################################################
@@ -86,27 +87,6 @@ def _getstep() -> Dict[str, Any]:
86
87
  return _getbody()['step']
87
88
 
88
89
 
89
- ########################################################################
90
- ## Exception helpers
91
-
92
-
93
- class ExecutionError(Exception):
94
- """An ExecutionError exception.
95
-
96
- Only expected to be raised in a workflow thread. Will publish
97
- the corresponding ExecutionError event if in this context.
98
- """
99
-
100
- def __init__(self, *args):
101
- if args:
102
- self.message = args[0]
103
- else:
104
- self.message = None
105
-
106
- def __str__(self):
107
- return str(self.message)
108
-
109
-
110
90
  ########################################################################
111
91
  ## Publication helpers
112
92
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: opentf-toolkit-nightly
3
- Version: 0.60.0.dev1227
3
+ Version: 0.60.0.dev1230
4
4
  Summary: OpenTestFactory Orchestrator Toolkit
5
5
  Home-page: https://gitlab.com/henixdevelopment/open-source/opentestfactory/python-toolkit
6
6
  Author: Martin Lafaix
@@ -1,7 +1,8 @@
1
- opentf/commons/__init__.py,sha256=JLif958eOnOeJSQ6bLF-Dpr_aFJ3JtxHrjvUe_KbzEc,22579
1
+ opentf/commons/__init__.py,sha256=xbDeHfYHshJtopyxljdTWw5vUXcUKosU6ILDNcEBZrY,22598
2
2
  opentf/commons/auth.py,sha256=bM2Z3kxm2Wku1lKXaRAIg37LHvXWAXIZIqjplDfN2P8,15899
3
- opentf/commons/config.py,sha256=dyus4K5Zdmcftc3Y9Z1YRkzA1KwiRLHoeAlg2_A49QM,7876
4
- opentf/commons/datasources.py,sha256=GSbjrYnZQup2B3r7T7l3C_o6R2jS13nQiu6dRitoenk,26194
3
+ opentf/commons/config.py,sha256=_8WzSaeB0yjGRa8mTQ69OASyUSbKZbwNOiKpMp2jFwI,7842
4
+ opentf/commons/datasources.py,sha256=c_bqqpiFibkRur75oIwV-gZtCLnluTS-9oVBoQ_NgGo,26054
5
+ opentf/commons/exceptions.py,sha256=7dhUXO8iyAbqVwlUKxZhgRzGqVcb7LkG39hFlm-VxIA,2407
5
6
  opentf/commons/expressions.py,sha256=jM_YKXVOFhvOE2aE2IuacuvxhIsOYTFs2oQkpcbWR6g,19645
6
7
  opentf/commons/pubsub.py,sha256=M0bvajR9raUP-xe5mfRjdrweZyHQw1_Qsy56gS-Sck4,7676
7
8
  opentf/commons/schemas.py,sha256=cjyPXRhRIPQauCdy9zGRaOkqdVcklz47JnljTTLNpq8,4254
@@ -57,9 +58,9 @@ opentf/scripts/launch_java_service.sh,sha256=S0jAaCuv2sZy0Gf2NGBuPX-eD531rcM-b0f
57
58
  opentf/scripts/startup.py,sha256=sggwEpMx7PTaSgYzs-2uCF5YZzpsncMyTlfF_G60CrE,21518
58
59
  opentf/toolkit/__init__.py,sha256=mYeJPZ92ulbTBItqEsZgF4nnuRh6G19QPY3Jxc92ifc,23028
59
60
  opentf/toolkit/channels.py,sha256=h5QLrr4vNLKjt8K524ZcJMqmHhE9kV5lxiW-MN6zMvQ,23622
60
- opentf/toolkit/core.py,sha256=cscUkwdwvLkerqMRL05dgtKJ42QbBQQc28kRBiyZM9o,9883
61
- opentf_toolkit_nightly-0.60.0.dev1227.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
62
- opentf_toolkit_nightly-0.60.0.dev1227.dist-info/METADATA,sha256=oq7pzSi2ckp4_KQ5nDD5B75w_wQ6AiGT1uuuymRrDUg,1932
63
- opentf_toolkit_nightly-0.60.0.dev1227.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
64
- opentf_toolkit_nightly-0.60.0.dev1227.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
65
- opentf_toolkit_nightly-0.60.0.dev1227.dist-info/RECORD,,
61
+ opentf/toolkit/core.py,sha256=fqnGgaYnuVcd4fyeNIwpc0QtyUo7jsKeVgdkBfY3iqo,9443
62
+ opentf_toolkit_nightly-0.60.0.dev1230.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
63
+ opentf_toolkit_nightly-0.60.0.dev1230.dist-info/METADATA,sha256=PdJ6rkck6iblkKJG4M0n7Us3nWTGIOULosmmxqGlkig,1932
64
+ opentf_toolkit_nightly-0.60.0.dev1230.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
65
+ opentf_toolkit_nightly-0.60.0.dev1230.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
66
+ opentf_toolkit_nightly-0.60.0.dev1230.dist-info/RECORD,,