david-caro / python-foreman

Small low level python wrapper around Foreman API
GNU General Public License v2.0
58 stars 37 forks source link

Adding support with search query #27

Closed avi3tal closed 9 years ago

avi3tal commented 9 years ago

Adding create_search_func to resource Meta class to automatically create search method in every Resource. Search method will invoke "?search=..." built-in every resource. The paramater is only *args which refer to list of conditions will be translated into search line in the same order they have bin given fire example:

client.hosts.search('hosts_id=1', 'mac=aa:aa:aa:aa:aa:aa') { .. results[..]} }

Note: i haven't used **kwargs just becuse Foreman search engine influanced by the order of the conditions (just like in pipe command).

[ticket: n/a]

lukas-bednar commented 9 years ago

hm, it looks like bug related to new foreman. it works for older (1.5.1) version. one more Q: do you use apiv2 or apiv1?

avi3tal commented 9 years ago

I use apiv2 Foreman(url='http://x.x.x.x', auth=('admin', '*****'), api_version=2)

definitions/1.7.2-v2.json

lukas-bednar commented 9 years ago

ok, so it is serious bug!

avi3tal commented 9 years ago

This is my bug https://github.com/david-caro/python-foreman/issues/26

Who's working on it in your side?

david-caro commented 9 years ago

should be solved on #37