2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 05:55:28 +00:00

Hammer: Make sure we account for the case when hammer is called on another Kea source tree when installing SSL keys

This commit is contained in:
Andrei Pavel
2025-05-07 12:10:47 +03:00
parent ef54c10a92
commit 5cad02bf6c

View File

@@ -1311,12 +1311,17 @@ def _configure_mysql(system, revision, features):
if 'tls' in features:
if not os.path.isdir(cert_dir):
execute('sudo mkdir -p {}'.format(cert_dir))
# Parent dir of hammer.py.
p = os.path.dirname(os.path.realpath(os.path.abspath(sys.argv[0])))
if not os.path.isdir(f'{p}/src/lib/asiolink/testutils/ca'):
# Sometimes we call a standalone hammer.py on another Kea source tree. Let's use cwd in that case.
p = '.'
for file in [
'./src/lib/asiolink/testutils/ca/kea-ca.crt',
'./src/lib/asiolink/testutils/ca/kea-client.crt',
'./src/lib/asiolink/testutils/ca/kea-client.key',
'./src/lib/asiolink/testutils/ca/kea-server.crt',
'./src/lib/asiolink/testutils/ca/kea-server.key',
f'{p}/src/lib/asiolink/testutils/ca/kea-ca.crt',
f'{p}/src/lib/asiolink/testutils/ca/kea-client.crt',
f'{p}/src/lib/asiolink/testutils/ca/kea-client.key',
f'{p}/src/lib/asiolink/testutils/ca/kea-server.crt',
f'{p}/src/lib/asiolink/testutils/ca/kea-server.key',
]:
if not os.path.exists(file):
print('ERROR: File {} is needed to prepare TLS.'.format(file), file=sys.stderr)