HTTP response codes should be extracted to constants

Bug #1520159 reported by Ferenc Horváth
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Pooja Jadhav
Glance
Fix Released
Wishlist
Gábor Antal
masakari
Fix Released
Wishlist
Dinesh Bhor

Bug Description

There are several places in the source code where HTTP response codes are used as numeric values. These values should be extracted to a common file and the numeric values should be replaced by constants.

For example:
common/auth.py:186
  elif resp.status == 404: --> elif resp.status == HTTP_NOT_FOUND;
api/middleware/cache.py:261
  if method == 'GET' and status_code == 204: --> if method == 'GET' and status_code == HTTP_NO_CONTENT:

Changed in glance:
assignee: nobody → Gábor Antal (gabor.antal)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

Fix proposed to branch: master
Review: https://review.openstack.org/273196

Changed in glance:
status: New → In Progress
Changed in glance:
importance: Undecided → Wishlist
Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

See comments on https://review.openstack.org/#/c/273196/8 for a discussion about why this is worth doing.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/273196
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=8a636223487d2f8b9639e84799334bc29706875f
Submitter: Jenkins
Branch: master

commit 8a636223487d2f8b9639e84799334bc29706875f
Author: Gábor Antal <email address hidden>
Date: Wed Jan 27 19:48:57 2016 +0100

    Extracted HTTP response codes to constants

    There are several places in the source code where
    HTTP response codes are used as numeric values.
    These values are used from six.moves and the
    numeric values are replaced by constants.

    All of the used status codes were replaced with symbolic constants
    from six.moves.http_client. More about six.moves.http_client can be
    found at [2], under the table "Supported renames:".

    Also, this change improves code readibility.

    This patchset does not extract numeric values
    from the tests, but it can be found at [1].

    [1]: Idfc7b043552f428f01ac3e47b270ee0639a8f5bc
    [2]: https://pythonhosted.org/six/#module-six.moves

    Change-Id: Ib9e26dcea927e96e65c626c18421621d3a29a64d
    Partial-Bug: #1520159

Changed in glance:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/360378
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=8a8e5bf56c7bd5ca9877e49fda8f5a95064a003b
Submitter: Jenkins
Branch: master

commit 8a8e5bf56c7bd5ca9877e49fda8f5a95064a003b
Author: Gábor Antal <email address hidden>
Date: Thu Aug 25 11:39:21 2016 +0200

    Extracted HTTP response codes to constants in tests

    There are several places in the source code where
    HTTP response codes are used as numeric values.

    These values are used from six.moves and the
    numeric values are replaced by constants.

    All of the used status codes were replaced with symbolic constants
    from six.moves.http_client.
    More about six.moves.http_client can be found at [2],
    under the table "Supported renames:".

    Also, this change improves code readibility.

    This patchset does not extract numeric values from
    the code itself, but it can be found at [1].

    [1]: Ib9e26dcea927e96e65c626c18421621d3a29a64d
    [2]: https://pythonhosted.org/six/#module-six.moves

    Change-Id: Idfc7b043552f428f01ac3e47b270ee0639a8f5bc
    Closes-Bug: #1520159

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/glance 14.0.0.0b1

This issue was fixed in the openstack/glance 14.0.0.0b1 development milestone.

Changed in masakari:
assignee: nobody → Dinesh Bhor (dinesh-bhor)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to masakari (master)

Fix proposed to branch: master
Review: https://review.openstack.org/416542

Changed in masakari:
status: New → In Progress
Tushar Patil (tpatil)
Changed in masakari:
importance: Undecided → Low
importance: Low → Wishlist
Changed in cinder:
assignee: nobody → Pooja Jadhav (poojajadhav)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/416862

Changed in cinder:
status: New → In Progress
no longer affects: swift
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to masakari (master)

Reviewed: https://review.openstack.org/416542
Committed: https://git.openstack.org/cgit/openstack/masakari/commit/?id=4f4c42bd8d5e4dcfb2172f1b2d7bf2c78c606f45
Submitter: Jenkins
Branch: master

commit 4f4c42bd8d5e4dcfb2172f1b2d7bf2c78c606f45
Author: Dinesh Bhor <email address hidden>
Date: Tue Jan 3 15:17:25 2017 +0530

    Extracted HTTP response codes to constants

    There are several places in the source code where HTTP response
    codes are used as numeric values.

    All of the used status codes are replaced with symbolic constants
    from six.moves.http_client to improve code readibility.

    Closes-Bug: #1520159

    Change-Id: Ic5e439fb1f33962979536fe1ac5e5320e2c50c40

Changed in masakari:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/416862
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=da90ffda5de64957cad2fa2bae99aba23029ede1
Submitter: Jenkins
Branch: master

commit da90ffda5de64957cad2fa2bae99aba23029ede1
Author: poojajadhav <email address hidden>
Date: Wed Jan 4 14:45:16 2017 +0530

    Extracted HTTP response codes to constants

    There are several places in the source code where HTTP response
    codes are used as numeric values.

    Status codes 200, 201, and 202 under api/contrib are replaced with
    symbolic constants from six.moves.http_client thus improves code
    readability. More patches will be submitted to address other status
    codes.

    Partial-Bug: #1520159

    Change-Id: I944ab762a268886715b37bed1704e4fd56dae4fb

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/426747

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/426749

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/426750

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/434892

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/434894

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/434895

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/434896

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/434898

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/426749
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=9f874a9ca05721228549f0be62a348cd1d1e8d90
Submitter: Jenkins
Branch: master

commit 9f874a9ca05721228549f0be62a348cd1d1e8d90
Author: poojajadhav <email address hidden>
Date: Mon Jan 23 19:20:33 2017 +0530

    Extracted HTTP response codes to constants

    There are several places in the source code where HTTP response
    codes are used as numeric values.

    Status codes 202, 204, 300 and 412 under api/v3 are replaced with
    symbolic constants from six.moves.http_client thus improves code
    readability. More patches will be submitted to address other status
    codes.

    Partial-Bug: #1520159

    Change-Id: I60d8d99827bfa1a6fc5b6dbb67d1d1fb3a3b95fe

Jay Bryant (jsbryant)
Changed in cinder:
milestone: none → pike-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/426750
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=90fed35450ee3cea562fbcf5fce770e53b466941
Submitter: Jenkins
Branch: master

commit 90fed35450ee3cea562fbcf5fce770e53b466941
Author: poojajadhav <email address hidden>
Date: Mon Jan 23 21:05:34 2017 +0530

    Extracted HTTP response codes to constants

    There are several places in the source code where HTTP response
    codes are used as numeric values.

    Status codes 200, 202, 204, 400, 403, 404, 405 and 413 under
    tests/functional, tests/tempest and tests/unit/api are replaced with
    symbolic constants from six.moves.http_client thus improves code
    readability. More patches will be submitted to address other status
    codes.

    Partial-Bug: #1520159
    Change-Id: Idc4d3ee8469e7a41dda2d33f4e0629442bbbce4c

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/426747
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=baa945bf3ebd55b7a5a11441839f113c73b68ef7
Submitter: Jenkins
Branch: master

commit baa945bf3ebd55b7a5a11441839f113c73b68ef7
Author: poojajadhav <email address hidden>
Date: Tue Jan 3 18:56:07 2017 +0530

    Extracted HTTP response codes to constants

    There are several places in the source code where HTTP response
    codes are used as numeric values.

    Status codes 200, 201, 202, 400, 403, 404, 405, 413, 500 under
    tests/unit/api/contrib are replaced with symbolic constants from
    six.moves.http_client thus improves code readability. More patches
    will be submitted to address other status codes.

    Partial-Bug: #1520159
    Change-Id: I924b033dd4c07bf897ba33121a2c6e382997faf7

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/426748
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=92980e4972356f16389539b4cc926d7b4ec1dc3c
Submitter: Jenkins
Branch: master

commit 92980e4972356f16389539b4cc926d7b4ec1dc3c
Author: poojajadhav <email address hidden>
Date: Wed Jan 4 15:59:44 2017 +0530

    Extracted HTTP response codes to constants

    There are several places in the source code where HTTP response
    codes are used as numeric values.

    Status codes 200, 202, 204, 300, 400, 401, 403, 404, 405, 409, 413,
    415, 500, 501, 503 under api/v1 and api/v2 are replaced with symbolic
    constants from six.moves.http_client thus improves code readability.
    More patches will be submitted to address other status codes.

    Partial-Bug: #1520159
    Change-Id: I7c61122a6b043d7d238bea95ef39d8fa97817df4

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/434895
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=dd495b880d0333b8a8a8fa21be807d456375d5c9
Submitter: Jenkins
Branch: master

commit dd495b880d0333b8a8a8fa21be807d456375d5c9
Author: poojajadhav <email address hidden>
Date: Wed Jan 25 21:07:42 2017 +0530

    Extracted HTTP response codes to constants

    There are several places in the source code where HTTP response
    codes are used as numeric values.

    Status codes 101, 200, 201, 202, 400, 401, 403, 404, 409, 413, 422, 424
    and 500 under tests/unit/volume/drivers are replaced with symbolic
    constants from six.moves.http_client thus improves code readability.
    More patches will be submitted to address other status codes.

    Partial-Bug: #1520159
    Change-Id: I491bd9a6e09d39626e3f0c8fa9a151fe1927ee3b

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/434892
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=665775f92438029aed1b3ea488bc82de934d7eaa
Submitter: Jenkins
Branch: master

commit 665775f92438029aed1b3ea488bc82de934d7eaa
Author: poojajadhav <email address hidden>
Date: Tue Jan 24 15:55:15 2017 +0530

    Extracted HTTP response codes to constants

    There are several places in the source code where HTTP response
    codes are used as numeric values.

    Status codes 200, 202, 204, 300, 400, 403, 404, 405 , 406 and 413 under
    tests/unit/api/v2 and tests/unit/api/v3 are replaced with symbolic
    constants from six.moves.http_client thus improves code readability.
    More patches will be submitted to address other status codes.

    Partial-Bug: #1520159
    Change-Id: Iaa337432f9a368c33be9a182d9074cc316241cb9

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/434896
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=adfa4c71dfa96b5be2d2d8093849fe05bd1421ef
Submitter: Jenkins
Branch: master

commit adfa4c71dfa96b5be2d2d8093849fe05bd1421ef
Author: poojajadhav <email address hidden>
Date: Fri Jan 27 19:19:17 2017 +0530

    Extracted HTTP response codes to constants

    There are several places in the source code where HTTP response
    codes are used as numeric values.

    Status codes 200, 202, 300, 400, 401, 403, 404, 405, 500 and 503 under
    tests/unit/volume/drivers are replaced with symbolic constants from
    six.moves.http_client thus improves code readability. More patches will
    be submitted to address other status codes.

    Partial-Bug: #1520159
    Change-Id: Id5034fb1cac935ce235d5605a2ae778f44d20fa1

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (master)

Change abandoned by Sean McGinnis (<email address hidden>) on branch: master
Review: https://review.openstack.org/434894
Reason: No updates, and multiple duplicate patches. Feel free to restore and update if further work is needed.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Sean McGinnis (<email address hidden>) on branch: master
Review: https://review.openstack.org/434898
Reason: No updates, and multiple duplicate patches. Feel free to restore and update if further work is needed.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.