def remove(): d = treq.delete(path, headers=headers(auth_token), log=lb_log) d.addCallback(check_success, [200, 202]) d.addCallback(treq.content) # To avoid https://twistedmatrix.com/trac/ticket/6751 d.addErrback(log_lb_unexpected_errors, lb_log, 'remove_node') d.addErrback(wrap_request_error, path, 'remove_node') d.addErrback(check_deleted_clb, loadbalancer_id, node_id) return d
def remove(): d = treq.delete(path, headers=headers(auth_token), log=lb_log) d.addCallback(check_success, [200, 202]) d.addCallback(treq.content ) # To avoid https://twistedmatrix.com/trac/ticket/6751 d.addErrback(log_lb_unexpected_errors, lb_log, 'remove_node') d.addErrback(wrap_request_error, path, 'remove_node') d.addErrback(check_deleted_clb, loadbalancer_id, node_id) return d
def remove(): d = treq.delete(path, headers=headers(auth_token), log=lb_log) # Success is 200/202. An LB not being found is 404. A node not being # found is a 404. But a deleted LB sometimes results in a 422. d.addCallback(log_on_response_code, lb_log, 'Node to delete does not exist', 404) d.addCallback(check_success, [200, 202, 404]) d.addCallback(treq.content) # To avoid https://twistedmatrix.com/trac/ticket/6751 d.addErrback(check_422_deleted) d.addErrback(log_lb_unexpected_errors, path, lb_log, 'remove_node') return d
def delete_with_delay(_bag, to_delay): d = treq.delete(path, headers=headers(_bag.auth_token), log=log) # Add 0.4 seconds delay to allow 150 requests per minute return d.addCallback(delay, clock, 0.4) if to_delay else d
def delete(): del_d = treq.delete(path, headers=headers(auth_token), log=log) del_d.addCallback(check_success, [404]) del_d.addCallback(treq.content) return del_d