コード例 #1
0
ファイル: _infrastructure.py プロジェクト: james-w/flocker
 def failure(reason):
     if reason.check(BadRequest):
         code = reason.value.code
         result = reason.value.result
     else:
         writeFailure(reason, logger, LOG_SYSTEM)
         code = INTERNAL_SERVER_ERROR
         result = incidentIdentifier
     request.setResponseCode(code)
     request.responseHeaders.setRawHeaders(b"content-type", [b"application/json"])
     return dumps(result)
コード例 #2
0
ファイル: _infrastructure.py プロジェクト: yilab/flocker
 def failure(reason):
     if reason.check(BadRequest):
         code = reason.value.code
         result = reason.value.result
     else:
         writeFailure(reason, logger, LOG_SYSTEM)
         code = INTERNAL_SERVER_ERROR
         result = incidentIdentifier
     request.setResponseCode(code)
     request.responseHeaders.setRawHeaders(
         b"content-type", [b"application/json"])
     return dumps({u"error": True, u"result": result})
コード例 #3
0
ファイル: _api.py プロジェクト: WUMUXIAN/flocker
 def handle_error(failure):
     if failure.check(BadRequest):
         code = failure.value.code
         body = failure.value.result
     else:
         writeFailure(failure)
         # Ought to INTERNAL_SERVER_ERROR but Docker doesn't
         # seem to test that code path at all, whereas it does
         # have tests for this:
         code = OK
         body = {u"Err": u"{}: {}".format(failure.type.__name__, failure.value)}
     return EndpointResponse(code, body)
コード例 #4
0
 def handle_error(failure):
     if failure.check(BadRequest):
         code = failure.value.code
         body = failure.value.result
     else:
         writeFailure(failure)
         # Ought to INTERNAL_SERVER_ERROR but Docker doesn't
         # seem to test that code path at all, whereas it does
         # have tests for this:
         code = OK
         body = {u"Err": u"{}: {}".format(failure.type.__name__,
                                          failure.value)}
     return EndpointResponse(code, body)
コード例 #5
0
ファイル: _loop.py プロジェクト: AlexRRR/flocker
 def error(failure):
     writeFailure(failure, self.fsm.logger)
     # We should retry quickly to redo the failed work:
     return _UNCONVERGED_DELAY
コード例 #6
0
 def error(failure):
     writeFailure(failure, self.fsm.logger)
     # We should retry to redo the failed work:
     return self._unconverged_sleep.sleep()
コード例 #7
0
ファイル: _loop.py プロジェクト: PradeepSingh1988/flocker
 def error(failure):
     writeFailure(failure, self.fsm.logger)
     # We should retry to redo the failed work:
     return self._unconverged_sleep.sleep()
コード例 #8
0
ファイル: _loop.py プロジェクト: sysuwbs/flocker
 def error(failure):
     writeFailure(failure, self.fsm.logger)
     # We should retry quickly to redo the failed work:
     return _UNCONVERGED_DELAY