Feature #185
closed
a which work around is to call the gethosts method multiple times e.g.
for an AND operations
gethosts(...) & gethosts(...)
this basically returns an array, so you can use logical operators on them.
This is a usable workaround but it is pretty unpleasant.
The old iclassify scripts are simple one-liners:
QUERY="tag:appserver AND NOT tag:foo AND NOT tag:platform AND NOT..etc"
New ones look more like this: (use += for 'or')
hosts = gethosts( { "class" => "appserver" } )
hosts -= gethosts( {"class" => "platform" } )
hosts -= gethosts( {"class" => "foo" } )
...
Just fyi the 'and' case works works cleanly:
hosts=gethosts( { "class" => ["appserver","foo"] } )
(Extra detail in case anyone else stumbles across this bug report and needs a solution :) ..)
Dis Connect wrote:
This is a usable workaround but it is pretty unpleasant.
The old iclassify scripts are simple one-liners:
QUERY="tag:appserver AND NOT tag:foo AND NOT tag:platform AND NOT..etc"
I just said its a work around for now :)
Just fyi the 'and' case works works cleanly:
yes I know - I did remember spending some time on getting it to work ;)
Doesn't work with verbose. So a basic query to get 5 facts about host class 'foo' and not class 'bar' can hammer the foreman server half to death:
- get all hosts 'foo'
- get all hosts 'bar' and subtract
- for all remaining hosts, query again by hostname, verbose.
- operate on the facts you want
This doesn't even pretend to scale..
With 'and not':
- get all hosts 'foo' and not 'bar', verbose
- operate on the facts you want
- Category set to Search
- Status changed from New to Closed
- Assignee set to Ohad Levy
- Target version set to 0.3
implemented as part of #719
Also available in: Atom
PDF