Fix problem in cloud-init integration when no log file is writen yet

Change-Id: I830de66b1845eea9dbb4d8475077260f9dd9b995
This commit is contained in:
Federico Ressi 2021-05-05 14:58:44 +02:00
parent 7eb10f7d11
commit deb905b111
1 changed files with 4 additions and 1 deletions

View File

@ -190,7 +190,10 @@ def wait_for_cloud_init_status(
output_file=str(output_file)) from ex
# show only the last log line
try:
last_log_line = str(log_file).splitlines()[-1]
except IndexError:
last_log_line = ""
LOG.debug(f"Waiting cloud-init status on host '{hostname}' to "
f"switch from '{actual_status}' to any of expected "
f"states ({', '.join(expected_states)}):\n\n"