SatelliteQE / nailgun

Why use a hammer when you can use a nailgun.
GNU General Public License v3.0
46 stars 83 forks source link

Different results using raw search and entity based search #349

Open rochacbruno opened 7 years ago

rochacbruno commented 7 years ago

Raw search (OK)

entities.Organization().search(query={'search': 'name=Orgcompany7, label=Orgcompany7'})
Making HTTP GET request to /katello/api/v2/organizations with options {'verify': False, 'data': '{"search": "name=Orgcompany7, label=Orgcompany7"}', 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and no data.

Entity attributes based search (not ok)

entities.Organization(name='Orgcompany7', label='Orgcompany7').search()
Making HTTP GET request to /katello/api/v2/organizations with options {'verify': False, 'data': '{"name": "Orgcompany7", "label": "Orgcompany7"}', 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and no data.
jbnance commented 7 years ago

This issue exists for Locations as well, and I'm guessing Puppet modules as seen in #363.

rochacbruno commented 7 years ago

@jbnance I found this issue when developing the https://github.com/SatelliteQE/satellite-populate tool.

There I solved by forcing raw_search in some entities https://github.com/SatelliteQE/satellite-populate/blob/master/satellite_populate/constants.py#L12

I'll include Location and PuppetModule there, but also I am thinking in a way to resolve this in nailgun maybe applying the same logic and forcing raw_searches using the given attibutes to build the search_query,

Thanks for reporting.

jbnance commented 7 years ago

@rochacbruno oh my gosh we're developing the same thing at the same time... I wish I would have known about that. I've been writing a "populate-satellite" script that uses JSON instead of YAML. facepalm

rochacbruno commented 7 years ago

@jbnance lets join our efforts in satellite-populate

rochacbruno commented 7 years ago

@jbnance docs on https://satellite-populate.readthedocs.io/en/latest/