[Openstack] [SWIFT] code reading

Kun Huang Academicgareth at gmail.com
Tue Feb 12 12:11:20 UTC 2013


Hi, Chmouel and Darrell

I know you're working on /swift/proxy/controllers/base.py for this bug:
https://review.openstack.org/#/c/21563/
I didn't know the
https://github.com/openstack/swift/blob/master/swift/proxy/controllers/base.py#L371
to
#372. Could you show me a simple understanding?

                    elif resp.status == HTTP_NOT_FOUND:
                        if result_code == 0:
                            result_code = HTTP_NOT_FOUND
                        elif result_code != HTTP_NOT_FOUND:
                            result_code = -1

In this part, given a 404 response, we should reset the variable
result_code. If result_code is 0, reset it 404, 404 do nothing, and
others set -1.


What's the case for the "-1"?

Furthermore, I simply think resp.status is sufficient condition to set
result_code, so why these judgement need the result_code value in last
loop (while attempts_left loop).



Gareth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20130212/81aab6e4/attachment.html>


More information about the Openstack mailing list