#418 executor: add friendly error when results.yml is missing
Merged 5 years ago by kparal. Opened 5 years ago by kparal.

@@ -120,6 +120,8 @@ 

  Special cases

  =============

  

+ .. _empty_results:

+ 

  Empty results

  -------------

  

@@ -118,6 +118,11 @@ 

        with open(results_path, 'w') as results_file:

            results_file.write(output)

  

+ .. note::

+ 

+   In the rare case when you don't want to report any results, the

+   ``results.yml`` still needs to exist. See :ref:`empty_results`.

+ 

  

  .. _task-variables:

  

@@ -477,6 +477,14 @@ 

          results_file = os.path.join(self.arg_data['artifactsdir'],

              test_playbook, 'taskotron', 'results.yml')

          log.info('Reporting results from: %s', results_file)

+ 

+         if not os.path.exists(results_file):

+             raise exc.TaskotronDirectiveError("Results file doesn't exist, "

+                 'assuming the task crashed. If you wish to report no results, '

+                 'the results file still needs to exist - consult '

+                 'documentation. Expected results file location: %s' %

+                 results_file)

+ 

          rdb = resultsdb_directive.ResultsdbDirective()

          rdb.process(params={"file": results_file}, arg_data=self.arg_data)

  

no initial comment

Metadata Update from @kparal:
- Request assigned

5 years ago

Commit d46438e fixes this pull-request

Pull-Request has been merged by kparal

5 years ago