opentf-toolkit-nightly 0.63.0.dev1418__py3-none-any.whl → 0.63.0.dev1421__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.
- opentf/scripts/startup.py +76 -29
- {opentf_toolkit_nightly-0.63.0.dev1418.dist-info → opentf_toolkit_nightly-0.63.0.dev1421.dist-info}/METADATA +1 -1
- {opentf_toolkit_nightly-0.63.0.dev1418.dist-info → opentf_toolkit_nightly-0.63.0.dev1421.dist-info}/RECORD +6 -6
- {opentf_toolkit_nightly-0.63.0.dev1418.dist-info → opentf_toolkit_nightly-0.63.0.dev1421.dist-info}/WHEEL +0 -0
- {opentf_toolkit_nightly-0.63.0.dev1418.dist-info → opentf_toolkit_nightly-0.63.0.dev1421.dist-info}/licenses/LICENSE +0 -0
- {opentf_toolkit_nightly-0.63.0.dev1418.dist-info → opentf_toolkit_nightly-0.63.0.dev1421.dist-info}/top_level.txt +0 -0
opentf/scripts/startup.py
CHANGED
|
@@ -434,43 +434,90 @@ def maybe_generate_token() -> None:
|
|
|
434
434
|
|
|
435
435
|
|
|
436
436
|
def maybe_populate_keystore() -> None:
|
|
437
|
-
"""Populate keystore if CURL_CA_BUNDLE defined."""
|
|
437
|
+
"""Populate Java keystore if CURL_CA_BUNDLE defined."""
|
|
438
438
|
if (ca_bundle := os.environ.get('CURL_CA_BUNDLE')) is None:
|
|
439
439
|
return
|
|
440
440
|
if not os.path.isfile(ca_bundle):
|
|
441
441
|
logging.error('CURL_CA_BUNDLE "%s" does not exist, aborting.', ca_bundle)
|
|
442
442
|
sys.exit(1)
|
|
443
443
|
|
|
444
|
-
|
|
444
|
+
with open(ca_bundle, 'r', encoding='utf-8') as bundle_file:
|
|
445
|
+
ca_list = bundle_file.read().split(CA_END)
|
|
446
|
+
if not ca_list[-1].rstrip():
|
|
447
|
+
ca_list.pop()
|
|
445
448
|
|
|
449
|
+
if truststore := os.environ.get('JAVA_TRUSTSTORE'):
|
|
450
|
+
logging.debug('Using truststore "%s".', truststore)
|
|
451
|
+
keystore = ('-keystore', truststore)
|
|
452
|
+
else:
|
|
453
|
+
logging.debug('Using default truststore.')
|
|
454
|
+
keystore = ('-cacerts',)
|
|
446
455
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
456
|
+
for ca_counter, ca in enumerate(ca_list):
|
|
457
|
+
add_keystore_certificate(ca_counter, f'{ca}{CA_END}', keystore)
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
def add_keystore_certificate(
|
|
461
|
+
ca_counter: int, ca: str, keystore: Tuple[str, ...]
|
|
462
|
+
) -> None:
|
|
463
|
+
"""Add certificate to keystore.
|
|
464
|
+
|
|
465
|
+
!!! warning
|
|
466
|
+
This calls `keytool`, which requires root privileges, as it
|
|
467
|
+
add certificates to the system's keystore.
|
|
468
|
+
|
|
469
|
+
Certificates will have an alias of the form:
|
|
470
|
+
|
|
471
|
+
`opentf:{ca_counter}_{random string}`
|
|
472
|
+
|
|
473
|
+
# Required parameters
|
|
474
|
+
|
|
475
|
+
- ca_counter: an integer, the certificate position in the bundle
|
|
476
|
+
- ca: the certificate as a string
|
|
477
|
+
"""
|
|
478
|
+
with tempfile.NamedTemporaryFile('w') as ca_file:
|
|
479
|
+
ca_path = ca_file.name
|
|
480
|
+
ca_alias = f'opentf:{ca_counter}_{os.path.basename(ca_path)}'
|
|
481
|
+
try:
|
|
482
|
+
ca_file.write(ca)
|
|
483
|
+
logging.debug('File "%s" written.', ca_path)
|
|
484
|
+
except IOError as err:
|
|
485
|
+
logging.error('An error occurred while writing the file: %s.', err)
|
|
486
|
+
sys.exit(1)
|
|
487
|
+
ca_file.flush()
|
|
488
|
+
try:
|
|
489
|
+
ca_import_execute = subprocess.run(
|
|
490
|
+
[
|
|
491
|
+
'keytool',
|
|
492
|
+
'-importcert',
|
|
493
|
+
'-alias',
|
|
494
|
+
ca_alias,
|
|
495
|
+
'-file',
|
|
496
|
+
ca_path,
|
|
497
|
+
'-storepass',
|
|
498
|
+
'changeit',
|
|
499
|
+
'-noprompt',
|
|
500
|
+
*keystore,
|
|
501
|
+
],
|
|
502
|
+
stdout=subprocess.PIPE,
|
|
503
|
+
stderr=subprocess.STDOUT,
|
|
504
|
+
check=True,
|
|
505
|
+
)
|
|
506
|
+
logging.debug(
|
|
507
|
+
'Certificate %d successfully added to keystore with alias %s:\n%s.',
|
|
508
|
+
ca_counter,
|
|
509
|
+
ca_alias,
|
|
510
|
+
ca_import_execute.stdout.decode().rstrip(''),
|
|
511
|
+
)
|
|
512
|
+
except subprocess.CalledProcessError as err:
|
|
513
|
+
logging.error(
|
|
514
|
+
'Failed to add certificate %d with alias %s to keystore: %s.\n%s',
|
|
515
|
+
ca_counter,
|
|
516
|
+
ca_alias,
|
|
517
|
+
err,
|
|
518
|
+
err.stdout.decode().rstrip(''),
|
|
519
|
+
)
|
|
520
|
+
sys.exit(1)
|
|
474
521
|
|
|
475
522
|
|
|
476
523
|
def _ensure_abac_if_defined(name, value):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opentf-toolkit-nightly
|
|
3
|
-
Version: 0.63.0.
|
|
3
|
+
Version: 0.63.0.dev1421
|
|
4
4
|
Summary: OpenTestFactory Orchestrator Toolkit
|
|
5
5
|
Home-page: https://gitlab.com/henixdevelopment/open-source/opentestfactory/python-toolkit
|
|
6
6
|
Author: Martin Lafaix
|
|
@@ -56,13 +56,13 @@ opentf/schemas/opentestfactory.org/v1beta1/ServiceConfig.json,sha256=m5ZgWAKbutu
|
|
|
56
56
|
opentf/schemas/opentestfactory.org/v1beta1/Workflow.json,sha256=QZ8mM9PhzsI9gTmwmKTWYNoRn--rtcM3L0PzgnPBfMU,15424
|
|
57
57
|
opentf/schemas/opentestfactory.org/v1beta2/ServiceConfig.json,sha256=rEvK2YWL5lG94_qYgR_GnLWNsaQhaQ-2kuZdWJr5NnY,3517
|
|
58
58
|
opentf/scripts/launch_java_service.sh,sha256=S0jAaCuv2sZy0Gf2NGBuPX-eD531rcM-b0fNyhmzSjw,2423
|
|
59
|
-
opentf/scripts/startup.py,sha256=
|
|
59
|
+
opentf/scripts/startup.py,sha256=DLanDaXutUTYcG2PwoJ34QH-5G0TwfLUY_xy1VkVOqA,23202
|
|
60
60
|
opentf/toolkit/__init__.py,sha256=YnH66dmePAIU7dq_xWFYTIEUrsL9qV9f82LRDiBzbzs,22057
|
|
61
61
|
opentf/toolkit/channels.py,sha256=BQh5ztQmIKpxns6ozDNto4YpegktydPZyhOO9F3g-2Q,27731
|
|
62
62
|
opentf/toolkit/core.py,sha256=jMBDIYZ8Qn3BvsysfKoG0iTtjOnZsggetpH3eXygCsI,9636
|
|
63
63
|
opentf/toolkit/models.py,sha256=PNfXVQbeyOwDfaNrLjcfhYm6duMSlNWBtZsWZcs53ag,6583
|
|
64
|
-
opentf_toolkit_nightly-0.63.0.
|
|
65
|
-
opentf_toolkit_nightly-0.63.0.
|
|
66
|
-
opentf_toolkit_nightly-0.63.0.
|
|
67
|
-
opentf_toolkit_nightly-0.63.0.
|
|
68
|
-
opentf_toolkit_nightly-0.63.0.
|
|
64
|
+
opentf_toolkit_nightly-0.63.0.dev1421.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
65
|
+
opentf_toolkit_nightly-0.63.0.dev1421.dist-info/METADATA,sha256=YBdxneEq5WD_IKStBxx6xDLMaoU15v3yOzNn-Qe0KmY,2215
|
|
66
|
+
opentf_toolkit_nightly-0.63.0.dev1421.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
67
|
+
opentf_toolkit_nightly-0.63.0.dev1421.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
|
|
68
|
+
opentf_toolkit_nightly-0.63.0.dev1421.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|