Reviewed: https://review.openstack.org/443941 Committed: https://git.openstack.org/cgit/openstack/craton/commit/?id=606926b89d2106fac4680052dbf984083f6a1e83 Submitter: Jenkins Branch: master
commit 606926b89d2106fac4680052dbf984083f6a1e83 Author: Thomas Maddox <email address hidden> Date: Thu Mar 9 17:11:45 2017 +0000
JSON Path-like querying for variables
This patch implements the ability to query for values in nested variable documents. For instance, if we had hosts with a variables that look like:
{ "hardware_profiles": { "disks": [ { "manufacturer": "seagate", "capacity_quantity": 2, "capacity_unit": "TB" }, { "manufacturer": "western", "capacity_quantity": 3, "capacity_unit": "TB" } ] } }
and we wanted to grab all of them with a disk that was manufactured by Seagate, we would like to be able to query like so:
GET /v1/hosts?vars=hardware_profiles.disks[*].manufacturer:"seagate"
This does modify the variables query to expect valid JSON values. So, strings need to be quoted, for instance.
Change-Id: Id597d3e57d2e28766fecd1b314f53176543e1b9d Closes-Bug: 1671116
Reviewed: https:/ /review. openstack. org/443941 /git.openstack. org/cgit/ openstack/ craton/ commit/ ?id=606926b89d2 106fac4680052db f984083f6a1e83
Committed: https:/
Submitter: Jenkins
Branch: master
commit 606926b89d2106f ac4680052dbf984 083f6a1e83
Author: Thomas Maddox <email address hidden>
Date: Thu Mar 9 17:11:45 2017 +0000
JSON Path-like querying for variables
This patch implements the ability to query for values
in nested variable documents. For instance, if we had
hosts with a variables that look like:
{
"hardware_ profiles" : {
"disks" : [
" manufacturer" : "seagate",
" capacity_ quantity" : 2,
" capacity_ unit": "TB"
" manufacturer" : "western",
" capacity_ quantity" : 3,
" capacity_ unit": "TB"
{
},
{
}
]
}
}
and we wanted to grab all of them with a disk that was
manufactured by Seagate, we would like to be able to
query like so:
GET /v1/hosts? vars=hardware_ profiles. disks[* ].manufacturer: "seagate"
This does modify the variables query to expect valid JSON
values. So, strings need to be quoted, for instance.
Change-Id: Id597d3e57d2e28 766fecd1b314f53 176543e1b9d
Closes-Bug: 1671116