--parents option access wrong URL

Bug #1499657 reported by Hidekazu Nakamura
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-openstackclient
Fix Released
Medium
Rui Chen

Bug Description

project show <project_name> --parents simply show only specified project.

--parents option is expected to access "/projects/<project_id>?parents_as_list".
but accessed /"projects?parents_as_list=True&name=<project_name>".

api-v3:
https://github.com/openstack/keystone-specs/blob/master/api/v3/identity-api-v3.rst#get-project

debug output:
http://paste.openstack.org/show/474012/

description: updated
Changed in python-openstackclient:
assignee: nobody → Rahul U Nair (rahulunair)
Revision history for this message
Hidekazu Nakamura (nakamura-h) wrote :

This bug seems to be by design.

project show( maybe other command also ) uses find_resource() method in openstackclient/common/utils.py.
https://github.com/openstack/python-openstackclient/blob/master/openstackclient/common/utils.py#L52

find_resource() method first tries to find by name_or_id. If it failed, list with query parameter of name_or_id.

project show --parents is the following:
If --parents option with project name is given, first try to find by project name with parents_as_list query paramter and fail. Then list project with query parameters of project name and parents_as_list.
Since list projects RESTful API does not accept query paramter parents_as_list, simply show project by query parameter of project name.

Changed in python-openstackclient:
assignee: Rahul U Nair (rahulunair) → nobody
description: updated
Revision history for this message
Steve Martinelli (stevemar) wrote :

You might be able to break this up by doing 2 calls.

  1. Get the project ID of the original project, using find_resources
  2. Again, using find_resources, pass in the project ID and the parents_as_list argument

I'm not sure how we want to show this data... since it's a bunch of nested data

Changed in python-openstackclient:
assignee: nobody → Hidekazu Nakamura (nakamura-h)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-openstackclient (master)

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

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

Change abandoned by Hidekazu Nakamura (<email address hidden>) on branch: master
Review: https://review.openstack.org/239308

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

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

Changed in python-openstackclient:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-openstackclient (master)

Change abandoned by Hidekazu Nakamura (<email address hidden>) on branch: master
Review: https://review.openstack.org/239828

Changed in python-openstackclient:
assignee: Hidekazu Nakamura (nakamura-h) → nobody
Rui Chen (kiwik-chenrui)
Changed in python-openstackclient:
assignee: nobody → Rui Chen (kiwik-chenrui)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-openstackclient (master)

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

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

Reviewed: https://review.openstack.org/431407
Committed: https://git.openstack.org/cgit/openstack/python-openstackclient/commit/?id=4679a4c1933da0b94efb5d3d453d119801289a97
Submitter: Jenkins
Branch: master

commit 4679a4c1933da0b94efb5d3d453d119801289a97
Author: Rui Chen <email address hidden>
Date: Thu Feb 9 17:25:36 2017 +0800

    Fix --parents and --children options in project show

    Options "--parents" and "--children" don't work in "project show"
    command, fix the issue and add related unit and functional tests.

    Change-Id: Id9965267a037442f1077f8e1929d0527981f643d
    Closes-Bug: #1499657

Changed in python-openstackclient:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-openstackclient 3.9.0

This issue was fixed in the openstack/python-openstackclient 3.9.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.