mistral client can not get mistral url correctly with haproxy configuration

Bug #1598018 reported by Spencer Yu
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
High
Nikolay Makhotkin

Bug Description

The haproxy configuration is:

echo "#add for mistral_api8989" >> /etc/haproxy/haproxy.cfg
echo "frontend mistral_api8989-fe ${CONTROLLER_FE_IP}:8989" >> /etc/haproxy/haproxy.cfg
echo " default_backend mistral_api8989-be " >> /etc/haproxy/haproxy.cfg
echo "backend mistral_api8989-be" >> /etc/haproxy/haproxy.cfg
echo " balance roundrobin" >> /etc/haproxy/haproxy.cfg
echo " server ${CONTROLLER01_NAME} ${CONTROLLER01_IP}:8989 check " >> /etc/haproxy/haproxy.cfg
echo " server ${CONTROLLER02_NAME} ${CONTROLLER02_IP}:8989 check " >> /etc/haproxy/haproxy.cfg
echo "" >> /etc/haproxy/haproxy.cfg

The command "netstat -nultp| grep 8989" shows:

tcp 0 0 172.16.6.121:8989 0.0.0.0:* LISTEN 21316/python
tcp 0 0 172.16.6.120:8989 0.0.0.0:* LISTEN 190522/haproxy

when I use mistral dashboard, there is an error in /var/log/httpd/error_log:

Recoverable error: HTTPConnectionPool(host='localhost', port=8989): Max retries exceeded with url: /v2/workflows (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7fbbc80b3710>: Failed to establish a new connection: [Errno 111] Connection refused',))

It shows that the host to be listened is still localhost,that's not correct.

After debugging,I find that the problem is in mistralclient/api/v2/client.py:
In __init__ function:

    if not mistral_url:
        mistral_url = "http://localhost:8989/v2"

In authenticate function:

    if not mistral_url:
            catalog = keystone.service_catalog.get_endpoints(
                service_type=service_type,
                endpoint_type=endpoint_type
            )
            if service_type in catalog:
                service = catalog.get(service_type)
                mistral_url = service[0].get(
                    endpoint_type) if service else None

        return mistral_url, token, project_id, user_id

The problem is "mistral_url = service[0].get(endpoint_type) if service else None" can not get mistral_url,so mistral_url is still "http://localhost:8989/v2"

The reason is endpoint_type is "publicURL",but in service[0],it is not exist.

I find that publicURL of endpoint is used by old version of keystone,in Mitaka,keystone uses interface public and url instead of publicURL.

Revision history for this message
Jeremy Liu (liujiong) wrote :

Great catch!

Changed in mistral:
assignee: nobody → Lucky samadhiya (lucky-samadhiya)
Revision history for this message
Lucky samadhiya (lucky-samadhiya) wrote :

This bugs seems to be fixed in latest code

Changed in mistral:
assignee: Lucky samadhiya (lucky-samadhiya) → nobody
Changed in mistral:
assignee: nobody → Nikolay Makhotkin (nmakhotkin)
milestone: none → newton-3
importance: Undecided → High
status: New → Triaged
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-mistralclient (master)

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

Changed in mistral:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-mistralclient (stable/mitaka)

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/364267

Lingxian Kong (kong)
Changed in mistral:
milestone: newton-3 → newton-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-mistralclient (master)

Reviewed: https://review.openstack.org/364204
Committed: https://git.openstack.org/cgit/openstack/python-mistralclient/commit/?id=b9e87ef8633e29a7777bd061ba810756d4e48863
Submitter: Jenkins
Branch: master

commit b9e87ef8633e29a7777bd061ba810756d4e48863
Author: Nikolay Mahotkin <email address hidden>
Date: Thu Sep 1 12:50:27 2016 +0300

    Fixing getting mistral_url from keystone catalog

    Closes-Bug: #1598018

    Depends-On: I1b61bd1de6811a5f65c2375dde956aafe33445b2
    Change-Id: I16f1a5ff412d98371dfaab863cb24b47438d2d1e

Changed in mistral:
status: In Progress → Fix Released
tags: added: in-stable-mitaka
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-mistralclient (stable/mitaka)

Reviewed: https://review.openstack.org/364267
Committed: https://git.openstack.org/cgit/openstack/python-mistralclient/commit/?id=f730dab1afb67e1dad63a55d6477514f097ef2cd
Submitter: Jenkins
Branch: stable/mitaka

commit f730dab1afb67e1dad63a55d6477514f097ef2cd
Author: Nikolay Mahotkin <email address hidden>
Date: Thu Sep 1 12:50:27 2016 +0300

    Fixing getting mistral_url from keystone catalog

    Closes-Bug: #1598018

    Change-Id: I16f1a5ff412d98371dfaab863cb24b47438d2d1e

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-mistralclient (master)

Change abandoned by Spencer Yu (<email address hidden>) on branch: master
Review: https://review.openstack.org/336412

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-mistralclient 3.0.0

This issue was fixed in the openstack/python-mistralclient 3.0.0 release.

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.