--parents option access wrong URL

Bug #1499657 reported by Hidekazu Nakamura on 2015-09-25
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)
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
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)

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

Changed in python-openstackclient:
status: New → In Progress

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

Changed in python-openstackclient:
importance: Undecided → Medium

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) on 2017-02-09
Changed in python-openstackclient:
assignee: nobody → Rui Chen (kiwik-chenrui)

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

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  Edit
Everyone can see this information.

Other bug subscribers