Refactor #1173
remove legacy query interface
| Status: | Closed | Start: | 09/19/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | % Done: | 100% |
||
| Category: | Query interface | |||
| Target version: | 1.0 | |||
| Backlog: | No | Difficulity: | ||
| Votes: | 0 |
Description
with the introduction of the api, the query interface is no longer needed.
Related issues
| related to Foreman - Feature #945: foreman CLI | Closed | 05/26/2011 | ||
| duplicated by Foreman - Refactor #818: refactor example scripts to use foreman json api instead of the legacy query code | Closed | 04/01/2011 |
Associated revisions
Revision 17637a7526a033678ccad9fc65748525e44de13d
fixes #1173 - remove legacy query interface
Revision 5ff428072f9c5f3a15df0cd42c97df13e47eafd5
refs #1173 - remove unneed files
Revision 4edaa78b2f56d12418d633ec8c81eeae5ece6069
refs #1173 - another leftover
History
Updated by Brian Gupta over 1 year ago
- Assigned to set to Brian Gupta
Ohad,
I want to make sure what needs to be done here. Are we looking at refactoring ssh_using_foreman, or foreman.rb (or both) to work with the API? Or maybe you are thinking we can just get rid of both since foremancli now can do everything it can?
Thanks,
Brian
Updated by Brian Gupta over 1 year ago
Ohad, looking at the API docs, I'm not sure if there is a way to query the API for a list of hosts with certain puppetclasses http://theforeman.org/projects/foreman/wiki/API Am I missing something?
The other piece where you query for a list of hosts that match certain facts, seems to be implemented in the REST API as "/facts/<factname>/values"
However the ssh_using_foreman scriptallows ONE OR MORE facts in the query: "-f, --facts fact=x,fact=y.. one or more facts to filter the host list" I am not aware of how to do this in the API either.
Thoughts??
Updated by Brian Gupta over 1 year ago
Just realized that you probably have this functionality in the search API, I just can't find documentation for it.
Updated by Brian Gupta over 1 year ago
I ended up using the GUI to generate a query, and tailed the production log to find how the searches are encoded, and found this as an example: https://foreman/hosts?search=+class++%3D++base%3A%3Amonitor-only++or++class++%3D++apache2%3A%3Agb
You don't have this more cleanly documented somewhere or a code example, do you?
Updated by Brian Gupta over 1 year ago
And facts might be a problem as the GUI returned this when I started with Facts =":
Field 'facts' not recognized for searching!
Updated by Brian Gupta over 1 year ago
- % Done changed from 0 to 10
There may be some weird behavior with "OR" that I think is a bug, but "AND" seems to be working. (For future reference the search I did that triggered the bug was facts.hostname=redmine or facts.hostname=dev1, I will be doing further testing and open a bug report.)
Updated by Brian Gupta over 1 year ago
Ohad,
Nevermind about the "OR" issue. It was already discovered and closed. One question about how ssh_using_foreman is supposed to work filtering multiple puppetclasses or facts, is it an AND or an OR?
Thanks,
Brian
Updated by Brian Gupta over 1 year ago
Note to self /usr/bin/ruby is hardcoded, should replace with /usr/bin/env ruby. Also, gem net-ssh-multi is required.. thinking that might not be in the list of required gems for foreman.
Updated by Brian Gupta over 1 year ago
Reminder to update http://theforeman.org/projects/foreman/wiki/Query_Interface once we make these changes.
Updated by Ohad Levy over 1 year ago
- Category set to Query interface
- Assigned to changed from Brian Gupta to Ohad Levy
- Target version set to 1.0
Updated by Ohad Levy over 1 year ago
- Status changed from New to Closed
- % Done changed from 10 to 100
Applied in changeset 17637a7526a033678ccad9fc65748525e44de13d.
