From b1c12ca120c3bdca8b1db53dc65b5caf8205e54f Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Tue, 4 Aug 2015 14:23:47 -0400 Subject: [PATCH] Fix empty standard out behavior Previously we could just check for the absence of the stdout file to know we didn't yet/wouldn't ever have any stdout content. Now that we are creating the stdout file ahead of time and persisting it we need to also check to see if the file contains any data. This is also necessary for some unit tests. --- awx/main/models/unified_jobs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/main/models/unified_jobs.py b/awx/main/models/unified_jobs.py index 117ba4a261..00deb50691 100644 --- a/awx/main/models/unified_jobs.py +++ b/awx/main/models/unified_jobs.py @@ -598,7 +598,7 @@ class UnifiedJob(PolymorphicModel, PasswordFieldsModel, CommonModelNameNotUnique if self.result_stdout_text: return StringIO(self.result_stdout_text) else: - if not os.path.exists(self.result_stdout_file): + if not os.path.exists(self.result_stdout_file) or os.stat(self.result_stdout_file).st_size < 1: return StringIO(msg['missing' if self.finished else 'pending']) # There is a potential timing issue here, because another