Open atomic111 opened 1 year ago
do the results change at all if the query is modified from
vsphere.datacenters.all( vms.all( advancedSettings['tools.guest.desktop.autolock'].downcase == false ) ) [failed] [].all()
to
vsphere.datacenters.all( vms.where( advancedSettings['tools.guest.desktop.autolock'].downcase == false ) ) [failed] [].all()
when I tested this I believe I noticed that the expected true case was coming back as string true, not bool true.
ill go run that test again soon and update here
This could also be caused by the nested .all( x.all () )
I think its what Chris said. all
is special in its compilation and meaning. Its going to be the outer all
that has special data collection. That all
is about datacenters. So its going to display all the datacenters for which the inner condition fails.
This can be seen in the compilation of the query:
-> block 1
entrypoints: [<1,4>]
1: vsphere
2: datacenters bind: <1,1> type:[]vsphere.datacenter
3: $whereNot bind: <1,2> type:[]vsphere.datacenter (ref<1,2>, => <2,0>)
4: $all bind: <1,3> type:bool
5: {} bind: <1,3> type:[]block (=> <4,0>)
-> block 2
entrypoints: [<2,4>]
1: vsphere.datacenter id = context
2: vms bind: <2,1> type:[]vsphere.vm
3: $whereNot bind: <2,2> type:[]vsphere.vm (ref<2,2>, => <3,0>)
4: $all bind: <2,3> type:bool
5: {} bind: <2,3> type:[]block (=> <5,0>)
-> block 3
entrypoints: [<3,5>]
1: vsphere.vm id = context
2: advancedSettings bind: <3,1> type:map[string]string
3: [] bind: <3,2> type:string ("tools.guest.desktop.autolock")
4: downcase bind: <3,3> type:string
5: == bind: <3,4> type:bool (false)
-> block 4
entrypoints: [<4,2> <4,3> <4,4>]
1: vsphere.datacenter id = context
2: moid bind: <4,1> type:string
3: name bind: <4,1> type:string
4: vms bind: <4,1> type:[]vsphere.vm
-> block 5
entrypoints: [<5,2> <5,3> <5,4> <5,5> <5,6>]
1: vsphere.vm id = context
2: moid bind: <5,1> type:string
3: name bind: <5,1> type:string
4: advancedSettings bind: <5,1> type:map[string]string
5: [] bind: <5,4> type:string ("tools.guest.desktop.autolock")
6: downcase bind: <5,5> type:string
all
gets compiled down to a whereNot
. We call block 4
on things matching the whereNot
, which in this cause is moid
, name
, and vms
@atomic111 can we see if https://github.com/mondoohq/cnquery/pull/4360 improves the display for you
i have the following test. My expectation is that I get only the list where the test result is false, but I get all VMs in the sphere cluster
to confirm it here the query