Пример #1
0
 def _run_if_branch(self, data, recursive_dry_run=False, branch_run=False):
     result = IfResult(data.condition,
                       lineno=data.lineno,
                       source=data.source,
                       type=data.type)
     error = None
     with StatusReporter(self._context, result, self._run):
         if data.error and self._run:
             raise DataError(data.error)
         run = self._should_run_branch(data.condition, branch_run,
                                       recursive_dry_run)
         runner = BodyRunner(self._context,
                             run=run,
                             templated=self._templated)
         try:
             if not recursive_dry_run:
                 runner.run(data.body)
         except ExecutionStatus as err:
             error = err
         if run:
             branch_run = True
         else:
             result.branch_status = result.NOT_RUN
         if data.orelse:
             self._run_if_branch(data.orelse, recursive_dry_run, branch_run)
         if error:
             raise error
Пример #2
0
 def run(self, data):
     with self._dry_run_recursion_detection(data) as recursive_dry_run:
         error = None
         with StatusReporter(data, IfResult(), self._context, self._run):
             for branch in data.body:
                 try:
                     if self._run_if_branch(branch, recursive_dry_run, data.error):
                         self._run = False
                 except ExecutionStatus as err:
                     error = err
                     self._run = False
             if error:
                 raise error
Пример #3
0
 def _run_if_branch(self, data, recursive_dry_run=False, branch_run=False):
     result = IfResult(data.condition, lineno=data.lineno, source=data.source,
                       type=data.type)
     with StatusReporter(self._context, result) as reporter:
         if data.error:
             raise DataError(data.error)
         if self._should_run_branch(data.condition, branch_run, recursive_dry_run):
             runner = StepRunner(self._context, self._templated)
             runner.run_steps(data.body)
             branch_run = True
         else:
             result.branch_status = 'NOT_RUN'
         if data.orelse:
             self._run_if_branch(data.orelse, recursive_dry_run, branch_run)
Пример #4
0
 def _run_if_branch(self, data, branch_run=False, recursive_dry_run=False):
     result = IfResult(data.condition,
                       lineno=data.lineno,
                       source=data.source,
                       type=data.type)
     with StatusReporter(self._context, result) as reporter:
         if data.error:
             raise DataError(data.error)
         if self._should_run_branch(data.condition, branch_run,
                                    recursive_dry_run):
             runner = StepRunner(self._context, self._templated)
             runner.run_steps(data.body)
             return True
         reporter.mark_as_not_run()
         return branch_run
Пример #5
0
 def run(self, data):
     # FIXME: Simplify handling branch run status
     with self._dry_run_recursion_detection(data) as recursive_dry_run:
         branch_run = False
         error = None
         with StatusReporter(self._context, IfResult(), self._run):
             for branch in data.body:
                 try:
                     if self._run_if_branch(branch, branch_run,
                                            recursive_dry_run, data.error):
                         branch_run = True
                 except ExecutionStatus as err:
                     error = err
                     branch_run = True
             if error:
                 raise error