Create job-output.txt together with JobDir

Otherwise this file will only exist after ansible has started. However
the build url is reported earlier which opens a window where the zuul
status page publishes a live streaming link but the link is not yet
accessible resulting in [1]. Creating the job-output.txt beforehand
should resolve this issue.

[1] Live log result:

  Log not found for build ID 94f4e27243a44e73a19808c328499a28
  --- END OF STREAM ---

Change-Id: I9c85a7a1aa925d6cf8080ef07f1855d28fa3c71a
This commit is contained in:
Tobias Henkel 2017-10-24 13:31:17 +02:00
parent aeb5a1288c
commit b753eda80b
1 changed files with 7 additions and 0 deletions

View File

@ -353,6 +353,13 @@ class JobDir(object):
self.pre_playbooks = []
self.post_playbooks = []
self.job_output_file = os.path.join(self.log_root, 'job-output.txt')
# We need to create the job-output.txt upfront in order to close the
# gap between url reporting and ansible creating the file. Otherwise
# there is a period of time where the user can click on the live log
# link on the status page but the log streaming fails because the file
# is not there yet.
with open(self.job_output_file, 'w'):
pass
self.trusted_projects = []
self.trusted_project_index = {}