def _run_if_branch(self, branch, recursive_dry_run=False, error=None):
     result = IfBranchResult(branch.type, branch.condition)
     run_branch = self._should_run_branch(branch.condition, recursive_dry_run)
     with StatusReporter(branch, result, self._context, run_branch):
         if error and self._run:
             raise DataError(error)
         runner = BodyRunner(self._context, run_branch, self._templated)
         if not recursive_dry_run:
             runner.run(branch.body)
     return run_branch
Example #2
0
 def _run_if_branch(self, branch, recursive_dry_run=False, error=None):
     context = self._context
     result = IfBranchResult(branch.type, branch.condition)
     if error:
         run_branch = False
     else:
         try:
             run_branch = self._should_run_branch(branch, context, recursive_dry_run)
         except:
             error = get_error_message()
             run_branch = False
     with StatusReporter(branch, result, context, run_branch):
         runner = BodyRunner(context, run_branch, self._templated)
         if not recursive_dry_run:
             runner.run(branch.body)
         if error and self._run:
             raise DataError(error)
     return run_branch