opentf-toolkit-nightly 0.50.0.dev702__py3-none-any.whl → 0.50.0.dev705__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.
@@ -35,7 +35,7 @@ from .config import (
35
35
  make_argparser,
36
36
  configure_logging,
37
37
  read_config,
38
- read_manifest,
38
+ read_descriptor,
39
39
  get_named,
40
40
  )
41
41
  from .auth import (
@@ -209,7 +209,7 @@ def _get_contextparameter_spec(app: Flask, name: str) -> Optional[Dict[str, Any]
209
209
  """
210
210
  if PARAMETERS_KEY not in app.config:
211
211
  app.config[PARAMETERS_KEY] = []
212
- for manifest in app.config['MANIFEST']:
212
+ for manifest in app.config['DESCRIPTOR']:
213
213
  if manifest.get('metadata', {}).get('name', '').lower() != app.name.lower():
214
214
  continue
215
215
  app.config[PARAMETERS_KEY] += manifest.get('spec', {}).get(
@@ -407,7 +407,7 @@ def make_app(
407
407
  configfile: str,
408
408
  schema: Optional[str] = None,
409
409
  defaultcontext: Optional[Dict[str, Any]] = None,
410
- manifest: Optional[Union[str, Dict[str, Any], List[Dict[str, Any]]]] = None,
410
+ descriptor: Optional[Union[str, Dict[str, Any], List[Dict[str, Any]]]] = None,
411
411
  ) -> Flask:
412
412
  """Create a new app.
413
413
 
@@ -421,7 +421,7 @@ def make_app(
421
421
 
422
422
  - schema: a string or None (None by default)
423
423
  - defaultcontext: a dictionary or None (None by default)
424
- - manifest: a filename, a dictionary or a list of dictionaries or
424
+ - descriptor: a filename, a dictionary or a list of dictionaries or
425
425
  None (None by default)
426
426
 
427
427
  # Returned value
@@ -431,7 +431,7 @@ def make_app(
431
431
 
432
432
  `CONFIG` is a dictionary, the complete config file. `CONTEXT` is a
433
433
  subset of `CONFIG`, the current entry in `CONFIG['context']`. It is
434
- also a dictionary. `MANIFEST` is the service manifest.
434
+ also a dictionary. `DESCRIPTOR` is the service descriptor.
435
435
 
436
436
  # Raised Exception
437
437
 
@@ -447,8 +447,9 @@ def make_app(
447
447
  args.config, args.context, configfile, defaultcontext, schema
448
448
  )
449
449
 
450
- if args.manifest is not None or manifest is None or isinstance(manifest, str):
451
- _, manifest = read_manifest(args.manifest, manifest)
450
+ if args.descriptor or descriptor is None or isinstance(descriptor, str):
451
+ _, descriptor = read_descriptor(args.descriptor, descriptor)
452
+
452
453
  if args.host:
453
454
  context['host'] = args.host
454
455
  if args.port:
@@ -463,7 +464,9 @@ def make_app(
463
464
 
464
465
  app.config['CONTEXT'] = context
465
466
  app.config['CONFIG'] = config
466
- app.config['MANIFEST'] = manifest if isinstance(manifest, list) else [manifest]
467
+ app.config['DESCRIPTOR'] = (
468
+ descriptor if isinstance(descriptor, list) else [descriptor]
469
+ )
467
470
  app.before_request(_make_authenticator(context))
468
471
  app.after_request(_add_securityheaders)
469
472
  return app
opentf/commons/config.py CHANGED
@@ -48,7 +48,7 @@ class ConfigError(Exception):
48
48
 
49
49
  def make_argparser(description: str, configfile: str) -> argparse.ArgumentParser:
50
50
  parser = argparse.ArgumentParser(description=description)
51
- parser.add_argument('--manifest', help='alternate manifest file')
51
+ parser.add_argument('--descriptor', help='alternate descriptor file')
52
52
  parser.add_argument(
53
53
  '--config', help=f'alternate config file (default to {configfile})'
54
54
  )
@@ -131,14 +131,14 @@ def _read_configfile(
131
131
  argsconfig: Optional[str], configfile: str
132
132
  ) -> Tuple[str, Dict[str, Any]]:
133
133
  try:
134
- configfile = argsconfig or configfile
135
- with open(configfile, 'r', encoding='utf-8') as cnf:
134
+ filename = argsconfig or configfile
135
+ with open(filename, 'r', encoding='utf-8') as cnf:
136
136
  config = yaml.safe_load(cnf)
137
137
  if not isinstance(config, dict):
138
138
  raise ValueError('Config file is not an object.')
139
- return configfile, config
139
+ return filename, config
140
140
  except Exception as err:
141
- raise ConfigError(f'Could not get configfile "{configfile}", aborting: {err}.')
141
+ raise ConfigError(f'Could not get configfile "{filename}", aborting: {err}.')
142
142
 
143
143
 
144
144
  def read_config(
@@ -169,27 +169,27 @@ def read_config(
169
169
  return context, config
170
170
 
171
171
 
172
- def read_manifest(
173
- argsmanifest: Optional[str], manifest: Any
172
+ def read_descriptor(
173
+ argsdescriptor: Optional[str], descriptor: Any
174
174
  ) -> Tuple[str, List[Dict[str, Any]]]:
175
175
  try:
176
- if argsmanifest:
177
- manifestfile = argsmanifest
176
+ if argsdescriptor:
177
+ filename = argsdescriptor
178
178
  else:
179
179
  for frame in inspect.stack():
180
180
  if frame.frame.f_code.co_name == '<module>':
181
181
  break
182
182
  else:
183
183
  raise ConfigError('Could not get module location, aborting.')
184
- manifestfile = os.path.join(
184
+ filename = os.path.join(
185
185
  os.path.dirname(frame.filename),
186
- manifest or 'service.yaml',
186
+ descriptor or 'service.yaml',
187
187
  )
188
- with open(manifestfile, 'r', encoding='utf-8') as definition:
188
+ with open(filename, 'r', encoding='utf-8') as definition:
189
189
  manifests = list(yaml.safe_load_all(definition))
190
- return manifestfile, manifests
190
+ return filename, manifests
191
191
  except Exception as err:
192
- raise ConfigError(f'Could not get manifest "{manifestfile}", aborting: {err}.')
192
+ raise ConfigError(f'Could not get descriptor "{filename}", aborting: {err}.')
193
193
 
194
194
 
195
195
  def get_named(name: str, entries: List[Dict[str, Any]]) -> Dict[str, Any]:
@@ -409,7 +409,7 @@ def run_plugin(plugin):
409
409
  context[SUBSCRIPTION_KEY] = []
410
410
  context[INPUTS_KEY] = {}
411
411
  if context[KIND_KEY] == PROVIDERCOMMAND:
412
- for manifest in plugin.config['MANIFEST']:
412
+ for manifest in plugin.config['DESCRIPTOR']:
413
413
  metadata = manifest.get('metadata', {})
414
414
  if metadata.get('name', '').lower() != plugin.name.lower():
415
415
  continue
@@ -445,7 +445,7 @@ def make_plugin(
445
445
  provider: Optional[Handler] = None,
446
446
  providers: Optional[Dict[str, Handler]] = None,
447
447
  publisher: Optional[Handler] = None,
448
- manifest=None,
448
+ descriptor=None,
449
449
  schema=None,
450
450
  configfile=None,
451
451
  ):
@@ -454,7 +454,7 @@ def make_plugin(
454
454
  One and only one of `channel`, `generator`, `provider`, `providers`,
455
455
  or `publisher` must be specified.
456
456
 
457
- If no `manifest` is specified, there must be `plugin.yaml` file in
457
+ If no `descriptor` is specified, there must be `plugin.yaml` file in
458
458
  the same directory as the caller source file. If none is found the
459
459
  execution stops.
460
460
 
@@ -472,8 +472,8 @@ def make_plugin(
472
472
 
473
473
  # Optional parameters
474
474
 
475
- - manifest: a dictionary or a list of dictionaries or None (None by
476
- default)
475
+ - descriptor: a dictionary or a list of dictionaries or None (None
476
+ by default)
477
477
  - schema: a string or None (None by default)
478
478
  - configfile: a string or None (None by default)
479
479
 
@@ -522,9 +522,9 @@ def make_plugin(
522
522
  raise ValueError(
523
523
  "One and only one of 'channel', 'generator', 'provider', 'providers', or 'publisher' is required."
524
524
  )
525
- if not (manifest is None or isinstance(manifest, (dict, list))):
525
+ if not (descriptor is None or isinstance(descriptor, (dict, list))):
526
526
  raise ValueError(
527
- "'manifest', if specified, must be a dictionary or a list of dictionaries."
527
+ "'descriptor', if specified, must be a dictionary or a list of dictionaries."
528
528
  )
529
529
 
530
530
  kind = (
@@ -542,7 +542,7 @@ def make_plugin(
542
542
  description,
543
543
  configfile=configfile or f'conf/{name}.yaml',
544
544
  schema=schema,
545
- manifest=manifest if manifest is not None else 'plugin.yaml',
545
+ descriptor=descriptor if descriptor is not None else 'plugin.yaml',
546
546
  )
547
547
  plugin.route('/inbox', methods=['POST'])(process_inbox)
548
548
  plugin.config['CONTEXT'][KIND_KEY] = kind
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: opentf-toolkit-nightly
3
- Version: 0.50.0.dev702
3
+ Version: 0.50.0.dev705
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,6 +1,6 @@
1
- opentf/commons/__init__.py,sha256=GAAWjd9yKan0HPA3cMFCtZ7wecB-K6hzcjDQDN6s9DM,22024
1
+ opentf/commons/__init__.py,sha256=06GO6FXo0zq7IJzDr4718FQ5IIze6EyReC0UACF3L0M,22063
2
2
  opentf/commons/auth.py,sha256=ADMygTSGy6voOQUAD9EtusPR_hgJ6jUK_uJE8CCpBoE,14481
3
- opentf/commons/config.py,sha256=y9TWJCdBPaWt0CRY-WxjfCe8OPEdqz8KgiWbuYwkgns,7016
3
+ opentf/commons/config.py,sha256=CJ3xGc9dmva08zek9FIMqFHkgwoPOukiXmafN2nm000,7006
4
4
  opentf/commons/expressions.py,sha256=dKcYYc7j3laueZEcV00djvE7UFPLMiUTNeNvKGla3cQ,19069
5
5
  opentf/commons/pubsub.py,sha256=_Psa3wdE_OB6wDHhUwr9zdxHpu5rSz19qtpM1Qo2WsY,5675
6
6
  opentf/commons/schemas.py,sha256=kMhZH47dpBk_HDMZk-1AlTb1dIYF-N6SPiEUmkEtWX0,3909
@@ -42,11 +42,11 @@ opentf/schemas/opentestfactory.org/v1beta1/Workflow.json,sha256=QZ8mM9PhzsI9gTmw
42
42
  opentf/schemas/opentestfactory.org/v1beta2/ServiceConfig.json,sha256=rEvK2YWL5lG94_qYgR_GnLWNsaQhaQ-2kuZdWJr5NnY,3517
43
43
  opentf/scripts/launch_java_service.sh,sha256=Ut_STdFqMhTV7cekPVp4JkBTqZKcJSAh1UNUn9Ylv3g,2427
44
44
  opentf/scripts/startup.py,sha256=CjKrFqbLyDKdUca-fWB-QkDURjdypkbrBUpEFNy3qQo,18719
45
- opentf/toolkit/__init__.py,sha256=HRh7YRtjlkqL_RJfAsEuVJGLHLEYFYkJUJj4We4ZwLM,18351
45
+ opentf/toolkit/__init__.py,sha256=4bL02Q3DgtMWZhaCvlJ7eOp9rPGIG9p-xNcs8hynhhQ,18371
46
46
  opentf/toolkit/channels.py,sha256=GGIPuUN7sFM_FwoqbUgLk7smggLty3rSDZTma5jAAt4,16185
47
47
  opentf/toolkit/core.py,sha256=40S-pUKXWidbI4JwkmQjGq46WlxJshj6d-wEl4e5TxU,7312
48
- opentf_toolkit_nightly-0.50.0.dev702.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
49
- opentf_toolkit_nightly-0.50.0.dev702.dist-info/METADATA,sha256=zc-MJXw11sEliv2F92kh8gu9UgLXjJO1lb1cD4QQLm8,1965
50
- opentf_toolkit_nightly-0.50.0.dev702.dist-info/WHEEL,sha256=5sUXSg9e4bi7lTLOHcm6QEYwO5TIF1TNbTSVFVjcJcc,92
51
- opentf_toolkit_nightly-0.50.0.dev702.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
52
- opentf_toolkit_nightly-0.50.0.dev702.dist-info/RECORD,,
48
+ opentf_toolkit_nightly-0.50.0.dev705.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
49
+ opentf_toolkit_nightly-0.50.0.dev705.dist-info/METADATA,sha256=2BuuxKrik9f7f_7FliEYZwaqUaov-XJbjPyIzAe4Er4,1965
50
+ opentf_toolkit_nightly-0.50.0.dev705.dist-info/WHEEL,sha256=5sUXSg9e4bi7lTLOHcm6QEYwO5TIF1TNbTSVFVjcJcc,92
51
+ opentf_toolkit_nightly-0.50.0.dev705.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
52
+ opentf_toolkit_nightly-0.50.0.dev705.dist-info/RECORD,,