retrieve_auth_url openstack utils and swift utils returns wrong URL if port is not present in Keystone URL

Bug #1473434 reported by Khanh-Toan TRAN
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Sahara
Fix Released
High
Khanh-Toan TRAN
Kilo
Fix Released
High
Vitalii Gridnev
Liberty
Fix Released
High
Khanh-Toan TRAN

Bug Description

There are two functions retrieve_auth_url(...) in sahara/utils/openstack/base.py and sahara/swift/utils.py. These two functions suppose to get the OS_AUTH_URL from identification URI:

sahara/utils/openstack/base.py:
    def retrieve_auth_url():
        ....
        return "%s://%s:%s/%s/" % (info.scheme, info.hostname, info.port, version)

sahara/swift/utils.py:
    def retrieve_auth_url():
    ....
    return '{scheme}://{hostname}:{port}/{url}/'.format(scheme=info.scheme,
                                                        hostname=info.hostname,
                                                        port=info.port,
                                                        url=url)

For instance, they would transform "https://keystone:5000/" to "https://keystone:5000/v2.0/"

However, these code do not work correctly if there is no port in the initial identity URI. They will transform "https://keystone/" to "https://keystone:None/v2.0/" which is an invalid URL.

Log: (while launching a job stored in Swift from Sahara)

2015-07-09 13:06:08.510 9158 DEBUG keystoneclient.auth.identity.v2 [-] Making authentication request tohttps://identity.lab0:None/v2.0/tokens get_auth_ref /usr/local/lib/python2.7/dist-packages/keystoneclient/auth/identity/v2.py:76
2015-07-09 13:06:08.644 9158 ERROR sahara.service.edp.job_manager [-] Can't run job execution 'fd80a9fc-3282-4753-97cc-b9796595d2c3'

Tags: auth url
description: updated
summary: - retrieve_auth_url returns wrong URL if port == None in openstack utils
- and swift utils
+ retrieve_auth_url openstack utils and swift utils returns wrong URL if
+ port is not present in Keystone URL
description: updated
Changed in sahara:
assignee: nobody → Khanh-Toan TRAN (toan-tran)
Changed in sahara:
status: New → Triaged
importance: Undecided → High
milestone: none → liberty-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to sahara (master)

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

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

Reviewed: https://review.openstack.org/200588
Committed: https://git.openstack.org/cgit/openstack/sahara/commit/?id=710ee9b8ad655d70aa70f3ace2a4e81ea8513b33
Submitter: Jenkins
Branch: master

commit 710ee9b8ad655d70aa70f3ace2a4e81ea8513b33
Author: Khanh-Toan Tran <email address hidden>
Date: Fri Jul 10 15:17:19 2015 +0000

    Fix retrieve_auth_url in case Keystone URL does not contain port.

    Sahara calls retrieve_auth_url() to retrieve auth_url from input
    uri. However, this function does not work correctly if input uri
    does not contain port.

    Change-Id: Ic7a65cd36a237d68151936404567c3bd7d068117
    Closes-Bug: #1473434

Changed in sahara:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to sahara (stable/kilo)

Reviewed: https://review.openstack.org/201804
Committed: https://git.openstack.org/cgit/openstack/sahara/commit/?id=3529f0396677b867ab93c2b120f8c1b1d588fa48
Submitter: Jenkins
Branch: stable/kilo

commit 3529f0396677b867ab93c2b120f8c1b1d588fa48
Author: Khanh-Toan Tran <email address hidden>
Date: Fri Jul 10 15:17:19 2015 +0000

    Fix retrieve_auth_url in case Keystone URL does not contain port.

    Sahara calls retrieve_auth_url() to retrieve auth_url from input
    uri. However, this function does not work correctly if input uri
    does not contain port.

    Change-Id: Ic7a65cd36a237d68151936404567c3bd7d068117
    Closes-Bug: #1473434
    (cherry picked from commit 710ee9b8ad655d70aa70f3ace2a4e81ea8513b33)

Thierry Carrez (ttx)
Changed in sahara:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in sahara:
milestone: liberty-2 → 3.0.0
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.