| OLD | NEW |
| 1 # Copyright 2015 The LUCI Authors. All rights reserved. | 1 # Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import collections | 5 import collections |
| 6 import copy | 6 import copy |
| 7 import json | 7 import json |
| 8 import operator | 8 import operator |
| 9 | 9 |
| 10 | 10 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 '"%s". Please examine that step for errors.' % (attr, step)) | 167 '"%s". Please examine that step for errors.' % (attr, step)) |
| 168 super(StepDataAttributeError, self).__init__(message) | 168 super(StepDataAttributeError, self).__init__(message) |
| 169 | 169 |
| 170 | 170 |
| 171 class StepData(object): | 171 class StepData(object): |
| 172 def __init__(self, step_config, retcode): | 172 def __init__(self, step_config, retcode): |
| 173 self._step_config = step_config | 173 self._step_config = step_config |
| 174 self._retcode = retcode | 174 self._retcode = retcode |
| 175 | 175 |
| 176 self._presentation = StepPresentation() | 176 self._presentation = StepPresentation() |
| 177 if retcode in step_config.ok_ret: |
| 178 self._presentation.status = 'SUCCESS' |
| 179 else: |
| 180 if not step_config.infra_step: |
| 181 self._presentation.status = 'FAILURE' |
| 182 else: |
| 183 self._presentation.status = 'EXCEPTION' |
| 184 |
| 177 self.abort_reason = None | 185 self.abort_reason = None |
| 178 | 186 |
| 179 @property | 187 @property |
| 180 def step(self): | 188 def step(self): |
| 181 return dict((k, v) for k, v in self._step_config._asdict().iteritems() if v) | 189 return dict((k, v) for k, v in self._step_config._asdict().iteritems() if v) |
| 182 | 190 |
| 183 @property | 191 @property |
| 184 def retcode(self): | 192 def retcode(self): |
| 185 return self._retcode | 193 return self._retcode |
| 186 | 194 |
| 187 @property | 195 @property |
| 188 def presentation(self): | 196 def presentation(self): |
| 189 return self._presentation | 197 return self._presentation |
| 190 | 198 |
| 191 def __getattr__(self, name): | 199 def __getattr__(self, name): |
| 192 raise StepDataAttributeError(self._step_config.name, name) | 200 raise StepDataAttributeError(self._step_config.name, name) |
| OLD | NEW |