Once the fix is merged, when we specify JSON or other machine readable format is requested, neutron CLI does not do any string conversion for data object like array or dict. A issue on lbaas pool members will be fixed too.
Akihiro 2016-09-30 21:43 GMT+09:00 Bill Nerenberg <[email protected]>: > Thanks for the feedback Akihiro > > Related to JSON formatting I also find that lbaas pool members shouldn't > be a string but instead it should be a JSON Array. > > Could this be something that could be improved? > > Thanks! > > Ulises > > On Fri, Sep 30, 2016 at 1:57 PM, Akihiro Motoki <[email protected]> wrote: > >> You hit https://bugs.launchpad.net/python-neutronclient/+bug/1524624. >> The current neutronclient formats an object to string even if non-table >> format is specified. >> https://review.openstack.org/#/c/255696/ is the fix but it lacks >> reviewers for 10 months :( >> >> >> 2016-09-30 18:16 GMT+09:00 Kevin Benton <[email protected]>: >> >>> Looks very much like a bug (double json encoding). File a bug on >>> launchpad against python-neutronclient. >>> >>> On Sep 30, 2016 05:10, "Bill Nerenberg" <[email protected]> >>> wrote: >>> >>>> Hi all >>>> >>>> When I run neutron -f json in the command below, the pools value is >>>> quoted so I cannot use it with JSON parsers like jq >>>> >>>> For example, this is neutron's problematic output [1] (see the pools >>>> line) >>>> >>>> $ neutron lbaas-loadbalancer-show ef315cff-1d0a-4327-93c6-e9bf7e544e2d >>>> -f json >>>> { >>>> "description": "", >>>> "admin_state_up": false, >>>> "tenant_id": "1bcf7ba13bcb496196d72f481bfebb5c", >>>> "provisioning_status": "ACTIVE", >>>> "vip_subnet_id": "d02c8267-30be-4cdc-aa4a-a7c1ca6504b8", >>>> "listeners": "", >>>> "vip_address": "10.0.2.160", >>>> "vip_port_id": "07227a77-1afe-466b-9d54-20e8637fc2b0", >>>> "provider": "f5networks", >>>> "pools": "{\"id\": \"1b792ace-0cbf-47cc-a3d5-2140c570ccee\"}", >>>> "id": "ef315cff-1d0a-4327-93c6-e9bf7e544e2d", >>>> "operating_status": "ONLINE", >>>> "name": "test-lbaasv2" >>>> } >>>> >>>> Which triggers an error in jq (or other tools) >>>> >>>> neutron lbaas-loadbalancer-show ef315cff-1d0a-4327-93c6-e9bf7e544e2d >>>> -f json | jq ".pools.id" >>>> jq: error: Cannot index string with string >>>> >>>> >>>> If instead I use the followin JSON without the double quotes it works >>>> just fine >>>> >>>> $ cat myjson >>>> { >>>> "description": "", >>>> "admin_state_up": false, >>>> "tenant_id": "1bcf7ba13bcb496196d72f481bfebb5c", >>>> "provisioning_status": "ACTIVE", >>>> "vip_subnet_id": "d02c8267-30be-4cdc-aa4a-a7c1ca6504b8", >>>> "listeners": "", >>>> "vip_address": "10.0.2.160", >>>> "vip_port_id": "07227a77-1afe-466b-9d54-20e8637fc2b0", >>>> "provider": "f5networks", >>>> "pools": {"id": "1b792ace-0cbf-47cc-a3d5-2140c570ccee"}, >>>> "id": "ef315cff-1d0a-4327-93c6-e9bf7e544e2d", >>>> "operating_status": "ONLINE", >>>> "name": "test-lbaasv2" >>>> } >>>> $ cat myjson | jq ".pools.id" >>>> "1b792ace-0cbf-47cc-a3d5-2140c570ccee" >>>> >>>> Questions, questions... >>>> >>>> Is it intentional the output of [1] or is it a bug? If it is not a bug >>>> and it is intentional... how is it expected we should be parsing it? >>>> >>>> Comments would be greatly appreciated >>>> >>>> Many thanks >>>> >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> Mailing list: http://lists.openstack.org/cgi >>>> -bin/mailman/listinfo/openstack >>>> Post to : [email protected] >>>> Unsubscribe : http://lists.openstack.org/cgi >>>> -bin/mailman/listinfo/openstack >>>> >>>> >>> _______________________________________________ >>> Mailing list: http://lists.openstack.org/cgi >>> -bin/mailman/listinfo/openstack >>> Post to : [email protected] >>> Unsubscribe : http://lists.openstack.org/cgi >>> -bin/mailman/listinfo/openstack >>> >>> >> >
_______________________________________________ Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack Post to : [email protected] Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
