Hammer fact list search for multiple facts

Problem: Trying to search for two facts: hostname (network::hostname) and virtual (virt::host_type). I can’t seem to get the correct syntax. I tried:

hammer fact list --seach “fact=network::hostname and value=myhost.local AND fact=virt::host_type and value=vmware”
I get nothing other than the header. Anyone know the correct way to do this?

Expected outcome:

Foreman and Proxy versions:

Foreman and Proxy plugin versions:

Distribution and version:

Other relevant data:

I’m not sure what exactly you want to get out of this, but you can’t really get any results if you use value = something and value = something_else as there’s no single record which would have two different values.

Would this do the trick?

hammer fact list --search '(fact=network::hostname AND value=myhost.local) OR (fact=virt::host_type AND value=vmware)'

Alternatively, if you want to get the values of virt::host_type for only a limited subset of hosts, then using host ^ (host1, host2, ...) and fact=virt::host_type AND value=vmware would work better.

I’m trying to figure out which hosts attached to the satellite server are VMs and which ones are hardware and which activation key they are using. I was thinking of getting a list of host names per activation key and then checking if it was hardware or virtual. There are many facts for each server. I don’t see why it would not be possible for both to be true? That is, if I search:

f=myhostname
hammer --csv fact list --search "(fact=network::hostname AND value=${f}) AND (fact=virt::host_type AND value=vmware)"

It should either just return the header, or the header plus one line. I can test for that and assign to either the hardware or virtual server list. I guess I’ll just create a list of all of the virtual hosts and another of all of the hardware hosts, then when searching by activation key, just grep from those lists and see which one has a hit.
I guess I don’t quite understand how facts work?

I found the answer:

hammer --csv fact list --search "facts.network::hostname=${f} AND facts.virt::host_type=vmware"

This works! Thanks for your suggestion!