RETIRED, OpenStack Search (Searchlight) Client
Go to file
Steve McLellan e8328fd7c2 Escape slashes in query_strings
Slashes (/) in query strings are treated by Elasticsearch as delimiting
a regexp expression. This is confusing especially when operating on
swift object paths, and in general we feel that in general the confusion
caused by mismatched slashes isn't offset by the ability to use regexps.
If a user really needs to run a regexp they can use the query dsl; we
could also consider adding a flag later.

Change-Id: I892541820b077d8eb08ae635a843d8dc84a5f55a
Closes-Bug: #1551946
2016-03-02 11:34:42 -06:00
doc Update link to CLI Reference 2016-01-16 17:46:56 +01:00
searchlightclient Escape slashes in query_strings 2016-03-02 11:34:42 -06:00
tools Init searchlightclient base 2015-11-28 16:40:16 +08:00
.gitignore Init searchlightclient base 2015-11-28 16:40:16 +08:00
.gitreview Added .gitreview 2015-11-19 10:13:03 +00:00
.testr.conf Init searchlightclient base 2015-11-28 16:40:16 +08:00
CONTRIBUTING.rst Init searchlightclient base 2015-11-28 16:40:16 +08:00
LICENSE Init searchlightclient base 2015-11-28 16:40:16 +08:00
MANIFEST.in Init searchlightclient base 2015-11-28 16:40:16 +08:00
README.rst Add resource type list CLI 2015-12-05 07:15:05 +08:00
babel.cfg Init searchlightclient base 2015-11-28 16:40:16 +08:00
openstack-common.conf Init searchlightclient base 2015-11-28 16:40:16 +08:00
requirements.txt Updated from global requirements 2016-02-20 22:00:45 +00:00
setup.cfg Merge "Added search resource client and cli" 2016-01-22 17:23:31 +00:00
setup.py Init searchlightclient base 2015-11-28 16:40:16 +08:00
test-requirements.txt Updated from global requirements 2016-01-19 13:52:56 +00:00
tox.ini Fix warning 'test command found but not installed in testenv' 2016-02-23 11:39:44 -06:00

README.rst

python-searchlightclient

OpenStack Indexing and Search API Client Library

This is a client library for Searchlight built on the Searchlight API. It provides a Python API (the searchlightclient module) and a command-line tool (searchlight).

The project is hosted on Launchpad, where bugs can be filed. The code is hosted on Github. Patches must be submitted using Gerrit, not Github pull requests.

python-searchlightclient is licensed under the Apache License like the rest of OpenStack.

Contents:

Command-line API

To execute CLI commands to standalone searchlight set with keystone.

  • Clone repository for python-searchlightclient:

    $ git clone https://github.com/openstack/python-searchlightclient.git
    $ cd python-searchlightclient
  • Setup a virtualenv

Note

This is an optional step, but will allow Searchlightclient's dependencies to be installed in a contained environment that can be easily deleted if you choose to start over or uninstall Searchlightclient.

$ tox -evenv --notest

Activate the virtual environment whenever you want to work in it. All further commands in this section should be run with the venv active:

$ source .tox/venv/bin/activate

Note

When ALL steps are complete, deactivate the virtualenv: $ deactivate

  • Install Searchlightclient and its dependencies:

    (venv) $ python setup.py develop
  • To execute CLI commands:

    $ export OS_USERNAME=<user>
    $ export OS_PASSWORD=<password>
    $ export OS_TENANT_NAME=<project>
    $ export OS_AUTH_URL='http://localhost:5000/v2.0/'

Note

With devstack you just need to $ source openrc <user> <project>

$ openstack
(openstack) search resource-type list
+--------------------------+--------------------------+
| Name                     | Type                     |
+--------------------------+--------------------------+
| OS::Designate::RecordSet | OS::Designate::RecordSet |
| OS::Designate::Zone      | OS::Designate::Zone      |
| OS::Glance::Image        | OS::Glance::Image        |
| OS::Glance::Metadef      | OS::Glance::Metadef      |
| OS::Nova::Server         | OS::Nova::Server         |
+--------------------------+--------------------------+

Python API

To use with keystone as the authentication system:

>>> from keystoneclient.auth.identity import generic
>>> from keystoneclient import session
>>> from searchlightclient import client
>>> auth = generic.Password(auth_url=OS_AUTH_URL, username=OS_USERNAME, password=OS_PASSWORD, tenant_name=OS_TENANT_NAME)
>>> keystone_session = session.Session(auth=auth)
>>> sc = client.Client('1', session=keystone_session)
>>> sc.resource_types.list()
[...]

Testing

There are multiple test targets that can be run to validate the code.

  • tox -e pep8 - style guidelines enforcement
  • tox -e py27 - traditional unit testing