2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 13:37:55 +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 2f2aa7700f
commit 0b34b8be3e
No known key found for this signature in database
GPG Key ID: D4E804481939CB21

View File

@ -1278,12 +1278,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)