I would like to use the "knife search node" command to identify nodes that have an empty or nil automatic['domain'] attribute. Is this possible?
The domain is emtpy or nil because /etc/hosts was updated manually with the incorrect order of "ip (hostname -s) fqdn" vs "ip (fqdn) (hostname -s)".
I have attempted the following searches:
knife search node -i
"etc_passwd:MYID AND NOT domain:*"
"etc_passwd:MYID AND NOT domain:*?*"
"etc_passwd:MYID AND NOT domain:[a TO z]"
"etc_passwd:MYID AND NOT domain:[a TO z]*"
"etc_passwd:MYID AND NOT domain:[* TO *]"
"etc_passwd:MYID AND NOT domain:[* TO *]*"
"etc_passwd:MYID AND NOT domain:([0 TO 9] [a TO z] [A TO Z])"
"etc_passwd:MYID AND NOT domain:([0 TO 9] [a TO z] [A TO Z])*"
"etc_passwd:MYID AND NOT _exists_:domain"
"etc_passwd:MYID AND domain:is_empty?"
"etc_passwd:MYID AND domain:null"
"etc_passwd:MYID AND domain:nil"
This knife exec search works, however it takes a significant amount of time to run against the node list.
knife exec -E "search(:node,'etc_passwd:MYID').select{|n|n.automatic['domain'].nil?}.each{|n| puts n.name}"
Any advice or direction would be greatly appreciated.
Thanks in advance. wcm