@@ -2248,13 +2248,19 @@ def _build_binaries_and_run_ut(system, revision, features, tarball_path, env, ch
2248
2248
2249
2249
def _check_installed_rpm_or_debs (services_list ):
2250
2250
for svc in services_list :
2251
- execute ('sudo systemctl stop %s' % svc )
2251
+ execute (f 'sudo systemctl stop { svc } ' )
2252
2252
now = datetime .datetime .now ()
2253
2253
timestamp = now .strftime ('%Y-%m-%d%H:%M:%S' )
2254
- execute ('sudo systemctl start %s' % svc )
2255
- time .sleep (3 )
2256
- cmd = "sudo journalctl --since %s -u %s | grep '_STARTED Kea'" % (timestamp , svc )
2257
- execute (cmd , attempts = 10 , sleep_time_after_attempt = 1 )
2254
+ execute (f'sudo systemctl start { svc } ' )
2255
+ logs = ''
2256
+ for _ in range (10 ):
2257
+ _ , logs = execute (f'sudo journalctl --since { timestamp } -u { svc } ' , capture = True )
2258
+ if '_STARTED Kea' in logs :
2259
+ break
2260
+ time .sleep (1 )
2261
+ if '_STARTED Kea' not in logs :
2262
+ print (logs )
2263
+ raise UnexpectedError ('_STARTED Kea not in logs' )
2258
2264
2259
2265
2260
2266
def _build_rpm (system , revision , features , tarball_path , env , check_times , dry_run ,
@@ -2429,15 +2435,19 @@ def _build_alpine_apk(revision, features, tarball_path, check_times, dry_run,
2429
2435
2430
2436
# check if kea services can be started
2431
2437
for svc in ['kea-dhcp4' , 'kea-dhcp6' , 'kea-ctrl-agent' , 'kea-dhcp-ddns' ]:
2432
- execute ('sudo rc-service %s start' % svc )
2433
- time .sleep (3 )
2438
+ execute (f'sudo rc-service { svc } start' )
2434
2439
if svc == 'kea-dhcp-ddns' :
2435
2440
svc = 'kea-ddns'
2436
- log_path = '/var/log/kea/%s.log' % svc
2437
- if revision == '3.10' :
2438
- log_path = '/var/log/%s.log' % svc
2439
- cmd = "sudo cat %s | grep '_STARTED Kea'" % log_path
2440
- execute (cmd , attempts = 10 , sleep_time_after_attempt = 1 )
2441
+ logs = ''
2442
+ log_path = f'/var/log/kea/{ svc } .log'
2443
+ for _ in range (10 ):
2444
+ _ , logs = execute (f'sudo cat { log_path } ' , capture = True )
2445
+ if '_STARTED Kea' in logs :
2446
+ break
2447
+ time .sleep (1 )
2448
+ if '_STARTED Kea' not in logs :
2449
+ print (logs )
2450
+ raise UnexpectedError ('_STARTED Kea not in logs' )
2441
2451
2442
2452
2443
2453
def _build_native_pkg (system , revision , features , tarball_path , env , check_times , dry_run , ccache_dir ,
0 commit comments