Project

General

Profile

Actions

Refactor #1173

closed

remove legacy query interface

Added by Ohad Levy over 12 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Search
Target version:
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

with the introduction of the api, the query interface is no longer needed.


Related issues 2 (0 open2 closed)

Related to Hammer CLI - Feature #945: foreman CLIClosedBrian Gupta05/26/2011Actions
Has duplicate Foreman - Refactor #818: refactor example scripts to use foreman json api instead of the legacy query codeClosed04/01/2011Actions
Actions #1

Updated by Brian Gupta over 12 years ago

  • Assignee 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

Actions #2

Updated by Brian Gupta over 12 years 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??

Actions #3

Updated by Brian Gupta over 12 years ago

Just realized that you probably have this functionality in the search API, I just can't find documentation for it.

Actions #4

Updated by Brian Gupta over 12 years 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?

Actions #5

Updated by Brian Gupta over 12 years ago

And facts might be a problem as the GUI returned this when I started with Facts =":

Field 'facts' not recognized for searching!

Actions #6

Updated by Brian Gupta over 12 years ago

Ah it's facts.fact = blah. Testing API now..

Actions #7

Updated by Brian Gupta over 12 years 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.)

Actions #8

Updated by Brian Gupta over 12 years 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

Actions #9

Updated by Brian Gupta over 12 years 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.

Actions #10

Updated by Brian Gupta over 12 years ago

Reminder to update http://theforeman.org/projects/foreman/wiki/Query_Interface once we make these changes.

Actions #11

Updated by Ohad Levy about 12 years ago

  • Category set to 19
  • Assignee changed from Brian Gupta to Ohad Levy
  • Target version set to 1.0
Actions #12

Updated by Ohad Levy about 12 years ago

  • Status changed from New to Closed
  • % Done changed from 10 to 100
Actions #13

Updated by Tomer Brisker over 5 years ago

  • Category changed from 19 to Search
Actions

Also available in: Atom PDF