<p dir="ltr">Looks very much like a bug (double json encoding). File a bug on launchpad against python-neutronclient. </p>
<div class="gmail_extra"><br><div class="gmail_quote">On Sep 30, 2016 05:10, "Bill Nerenberg" <<a href="mailto:bill.nerenberg75@gmail.com">bill.nerenberg75@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div>Hi all<br><br></div>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<br><br>For example, this is neutron's problematic output [1] (see the pools line)<br><br>$ neutron lbaas-loadbalancer-show ef315cff-1d0a-4327-93c6-<wbr>e9bf7e544e2d -f json <br>{<br>  "description": "", <br>  "admin_state_up": false, <br>  "tenant_id": "<wbr>1bcf7ba13bcb496196d72f481bfebb<wbr>5c", <br>  "provisioning_status": "ACTIVE", <br>  "vip_subnet_id": "d02c8267-30be-4cdc-aa4a-<wbr>a7c1ca6504b8", <br>  "listeners": "", <br>  "vip_address": "10.0.2.160", <br>  "vip_port_id": "07227a77-1afe-466b-9d54-<wbr>20e8637fc2b0", <br>  "provider": "f5networks", <br>  "pools": "{\"id\": \"1b792ace-0cbf-47cc-a3d5-<wbr>2140c570ccee\"}", <br>  "id": "ef315cff-1d0a-4327-93c6-<wbr>e9bf7e544e2d", <br>  "operating_status": "ONLINE", <br>  "name": "test-lbaasv2"<br>}<br><br></div>Which triggers an error in jq (or other tools)<br><br>neutron lbaas-loadbalancer-show ef315cff-1d0a-4327-93c6-<wbr>e9bf7e544e2d -f json | jq ".<a href="http://pools.id" target="_blank">pools.id</a>"<br>jq: error: Cannot index string with string<br><br><br></div>If instead I use the followin JSON without the double quotes it works just fine<br><br>$ cat myjson<br>{<br>  "description": "", <br>  "admin_state_up": false, <br>  "tenant_id": "<wbr>1bcf7ba13bcb496196d72f481bfebb<wbr>5c", <br>  "provisioning_status": "ACTIVE", <br>  "vip_subnet_id": "d02c8267-30be-4cdc-aa4a-<wbr>a7c1ca6504b8", <br>  "listeners": "", <br>  "vip_address": "10.0.2.160", <br>  "vip_port_id": "07227a77-1afe-466b-9d54-<wbr>20e8637fc2b0", <br>  "provider": "f5networks", <br>  "pools": {"id": "1b792ace-0cbf-47cc-a3d5-<wbr>2140c570ccee"}, <br>  "id": "ef315cff-1d0a-4327-93c6-<wbr>e9bf7e544e2d", <br>  "operating_status": "ONLINE", <br>  "name": "test-lbaasv2"<br>}<br>$ cat myjson | jq ".<a href="http://pools.id" target="_blank">pools.id</a>"<br>"1b792ace-0cbf-47cc-a3d5-<wbr>2140c570ccee"<br><br></div>Questions, questions...<br><br></div>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?<br><br></div>Comments would be greatly appreciated<br><br></div><div>Many thanks<br><br><br></div><div><br></div><div><div><div><div><div><div><br></div></div></div></div></div></div></div>
<br>______________________________<wbr>_________________<br>
Mailing list: <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack</a><br>
Post to     : <a href="mailto:openstack@lists.openstack.org">openstack@lists.openstack.org</a><br>
Unsubscribe : <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack</a><br>
<br></blockquote></div></div>