identity provider show prints python strings

Bug #1478995 reported by Richard Megginson
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-openstackclient
Fix Released
Medium
Steve Martinelli

Bug Description

doing `openstack --format csv identity provider show $idp` will print the remote_ids like this::

    [u'entityid_idp1', u'http://entityid_idp2/saml/meta', u'3']

These look like the python representation of unicode strings, not CSV format.

Ramaraja (ramaraja-r)
Changed in python-openstackclient:
assignee: nobody → Ramaraja (ramaraja-r)
Revision history for this message
Ramaraja (ramaraja-r) wrote :

Hi Richard,

python-openstackclient liberty version (1.5.0) supports 'html', 'json', 'shell', 'table', 'value', 'yaml' formats. I guess the csv option is removed for identity provider. Please let me know the client version that you are using.

Revision history for this message
Richard Megginson (rmeggins) wrote :

Sorry, we are using `--format shell`. The point of using --format shell is to output something that can be easily parsed in a shell environment. Something like::

    remote_ids="[u'entityid_idp1', u'http://entityid_idp2/saml/meta', u'3']"

is not so easily parsed. And, it just seems wrong to output the python string representation of the array, rather than an implementation independent format.

Revision history for this message
Sean Perry (sean-perry-a) wrote :

This appears to be working on master currently.

@rmeggins, is this still a bug for you?

Revision history for this message
Sean Perry (sean-perry-a) wrote :

    $ openstack --os-cloud BB identity provider show --format shell AA
    description="IdP for AA."
    enabled="True"
    id="AA"
    remote_ids="[]"

Revision history for this message
Sean Perry (sean-perry-a) wrote :

Never mind, I just needed a better test case. D'oh!

This is really an issue with 'cliff'. That is where the formatting occurs. There needs to be a "if type is list" check added somewhere between 'run' and 'produce_output'.

Ramaraja (ramaraja-r)
Changed in python-openstackclient:
assignee: Ramaraja (ramaraja-r) → nobody
Revision history for this message
Steve Martinelli (stevemar) wrote :

@richm, i think we should fix this like we do with other array based values;

stevemar@ubuntu:/opt/stack/python-openstackclient$ openstack identity provider create idp7 --remote-id 6 --remote-id 5 --format shell
description="None"
enabled="True"
id="idp7"
remote_ids="5, 6"

Revision history for this message
Steve Martinelli (stevemar) wrote :
Changed in python-openstackclient:
assignee: nobody → Steve Martinelli (stevemar)
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
Richard Megginson (rmeggins) wrote :

Sofer - does this work for you?

Revision history for this message
Sofer Athlan-Guyot (sofer-athlan-guyot) wrote :

Yes, I just tested the patch and now it's a plain string that is easily split using the comma as separator:

    openstack --os-username adminv3 --os-password a_big_secret --os-project-name openstackv3 --os-user-domain-name admin_domain --os-project-domain-name admin_domain --os-auth-url http://127.0
    .0.1:5000/v3 --os-identity-api-version 3 identity provider show --format shell bar
    description="Bar is done from a file"
    enabled="False"
    id="bar"
    remote_ids="http://remote_id_for_bar_1?id='bar', remote_id_for_bar_2"

instead of

    remote_ids="[u"http://remote_id_for_bar_1?id='bar'", u'remote_id_for_bar_2']"

Thanks,

Dean Troyer (dtroyer)
Changed in python-openstackclient:
milestone: none → next
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-openstackclient (master)

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

commit c079e137748d4914c0da56e2b148eb4495b41db4
Author: Steve Martinelli <email address hidden>
Date: Sun Oct 18 16:59:01 2015 -0400

    better format remote IDs for identity providers

    remote-ids are a list, and we should format these values as such,
    rather than python representations of lists/arrays.

    Closes-Bug: 1478995

    Change-Id: Ia6ced0fab2435b8cb486822c676c0dee32613abe

Changed in python-openstackclient:
status: In Progress → Fix Committed
Changed in python-openstackclient:
milestone: next → none
Changed in python-openstackclient:
milestone: none → 1.9.0
status: Fix Committed → Fix Released
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.