more gnocchi to aodh rename cleanup

This commit is contained in:
gordon chung 2015-12-15 11:41:51 -05:00
parent b3c8702b8a
commit 3c46e6b930
18 changed files with 118 additions and 118 deletions

View File

@ -1,7 +1,7 @@
[run] [run]
branch = True branch = True
source = gnocchiclient source = aodhclient
omit = gnocchiclient/openstack/* omit = aodhclient/openstack/*
[report] [report]
ignore_errors = True ignore_errors = True

View File

@ -1,4 +1,4 @@
[gerrit] [gerrit]
host=review.openstack.org host=review.openstack.org
port=29418 port=29418
project=openstack/python-gnocchiclient.git project=openstack/python-aodhclient.git

View File

@ -2,6 +2,6 @@
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./gnocchiclient/tests} $LISTOPT $IDOPTION ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./aodhclient/tests} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE test_id_option=--load-list $IDFILE
test_list_option=--list test_list_option=--list

View File

@ -1,4 +1,4 @@
gnocchiclient Style Commandments aodhclient Style Commandments
================================ ================================
Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/ Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/

View File

@ -1,15 +1,15 @@
============= =============
gnocchiclient aodhclient
============= =============
Python bindings to the OpenStack Gnocchi API Python bindings to the OpenStack Aodh API
This is a client for OpenStack gnocchi API. There's :doc:`a Python API This is a client for OpenStack Aodh API. There's :doc:`a Python API
<api>` (the :mod:`gnocchiclient` module), and a :doc:`command-line script <api>` (the :mod:`aodhclient` module), and a :doc:`command-line script
<shell>` (installed as :program:`gnocchi`). Each implements the entire <shell>` (installed as :program:`aodh`). Each implements the entire
OpenStack Gnocchi API. OpenStack Aodh API.
* Free software: Apache license * Free software: Apache license
* Documentation: http://docs.openstack.org/developer/python-gnocchiclient * Documentation: http://docs.openstack.org/developer/python-aodhclient
* Source: http://git.openstack.org/cgit/openstack/python-gnocchiclient * Source: http://git.openstack.org/cgit/openstack/python-aodhclient
* Bugs: http://bugs.launchpad.net/python-gnocchiclient * Bugs: http://bugs.launchpad.net/python-aodhclient

View File

@ -17,8 +17,8 @@ from keystoneauth1 import loading
from keystoneauth1 import plugin from keystoneauth1 import plugin
class GnocchiNoAuthPlugin(plugin.BaseAuthPlugin): class AodhNoAuthPlugin(plugin.BaseAuthPlugin):
"""No authentication plugin for Gnocchi """No authentication plugin for Aodh
This is a keystoneauth plugin that instead of This is a keystoneauth plugin that instead of
doing authentication, it just fill the 'x-user-id' doing authentication, it just fill the 'x-user-id'
@ -48,7 +48,7 @@ class GnocchiNoAuthPlugin(plugin.BaseAuthPlugin):
return self._endpoint return self._endpoint
class GnocchiOpt(loading.Opt): class AodhOpt(loading.Opt):
@property @property
def argparse_args(self): def argparse_args(self):
return ['--%s' % o.name for o in self._all_opts] return ['--%s' % o.name for o in self._all_opts]
@ -57,22 +57,22 @@ class GnocchiOpt(loading.Opt):
def argparse_default(self): def argparse_default(self):
# select the first ENV that is not false-y or return None # select the first ENV that is not false-y or return None
for o in self._all_opts: for o in self._all_opts:
v = os.environ.get('GNOCCHI_%s' % o.name.replace('-', '_').upper()) v = os.environ.get('AODH_%s' % o.name.replace('-', '_').upper())
if v: if v:
return v return v
return self.default return self.default
class GnocchiNoAuthLoader(loading.BaseLoader): class AodhNoAuthLoader(loading.BaseLoader):
plugin_class = GnocchiNoAuthPlugin plugin_class = AodhNoAuthPlugin
def get_options(self): def get_options(self):
options = super(GnocchiNoAuthLoader, self).get_options() options = super(AodhNoAuthLoader, self).get_options()
options.extend([ options.extend([
GnocchiOpt('user-id', help='User ID', required=True), AodhOpt('user-id', help='User ID', required=True),
GnocchiOpt('project-id', help='Project ID', required=True), AodhOpt('project-id', help='Project ID', required=True),
GnocchiOpt('roles', help='Roles', default="admin"), AodhOpt('roles', help='Roles', default="admin"),
GnocchiOpt('aodh-endpoint', help='Gnocchi endpoint', AodhOpt('aodh-endpoint', help='Aodh endpoint',
dest="endpoint", required=True), dest="endpoint", required=True),
]) ])
return options return options

View File

@ -35,7 +35,7 @@ from aodhclient.v1 import status_cli
from aodhclient.version import __version__ from aodhclient.version import __version__
class GnocchiCommandManager(commandmanager.CommandManager): class AodhCommandManager(commandmanager.CommandManager):
SHELL_COMMANDS = { SHELL_COMMANDS = {
"status": status_cli.CliStatusShow, "status": status_cli.CliStatusShow,
"resource list": resource_cli.CliResourceList, "resource list": resource_cli.CliResourceList,
@ -72,13 +72,13 @@ class GnocchiCommandManager(commandmanager.CommandManager):
self.add_command(name, command_class) self.add_command(name, command_class)
class GnocchiShell(app.App): class AodhShell(app.App):
def __init__(self): def __init__(self):
super(GnocchiShell, self).__init__( super(AodhShell, self).__init__(
description='Gnocchi command line client', description='Aodh command line client',
# FIXME(sileht): get version from pbr # FIXME(sileht): get version from pbr
version=__version__, version=__version__,
command_manager=GnocchiCommandManager(None), command_manager=AodhCommandManager(None),
deferred_help=True, deferred_help=True,
) )
@ -95,7 +95,7 @@ class GnocchiShell(app.App):
:param version: version number for the application :param version: version number for the application
:paramtype version: str :paramtype version: str
""" """
parser = super(GnocchiShell, self).build_option_parser(description, parser = super(AodhShell, self).build_option_parser(description,
version) version)
# Global arguments, one day this should go to keystoneauth1 # Global arguments, one day this should go to keystoneauth1
parser.add_argument( parser.add_argument(
@ -115,19 +115,19 @@ class GnocchiShell(app.App):
' (Env: OS_INTERFACE)') ' (Env: OS_INTERFACE)')
parser.add_argument( parser.add_argument(
'--aodh-api-version', '--aodh-api-version',
default=os.environ.get('GNOCCHI_API_VERSION', '1'), default=os.environ.get('AODH_API_VERSION', '2'),
help='Defaults to env[GNOCCHI_API_VERSION] or 1.') help='Defaults to env[AODH_API_VERSION] or 2.')
loading.register_session_argparse_arguments(parser=parser) loading.register_session_argparse_arguments(parser=parser)
plugin = loading.register_auth_argparse_arguments( plugin = loading.register_auth_argparse_arguments(
parser=parser, argv=sys.argv, default="password") parser=parser, argv=sys.argv, default="password")
if not isinstance(plugin, noauth.GnocchiNoAuthLoader): if not isinstance(plugin, noauth.AodhNoAuthLoader):
parser.add_argument( parser.add_argument(
'--aodh-endpoint', '--aodh-endpoint',
metavar='<endpoint>', metavar='<endpoint>',
dest='endpoint', dest='endpoint',
default=os.environ.get('GNOCCHI_ENDPOINT'), default=os.environ.get('AODH_ENDPOINT'),
help='Gnocchi endpoint (Env: GNOCCHI_ENDPOINT)') help='Aodh endpoint (Env: AODH_ENDPOINT)')
return parser return parser
@ -167,7 +167,7 @@ class GnocchiShell(app.App):
# Set this here so cliff.app.configure_logging() can work # Set this here so cliff.app.configure_logging() can work
self.options.verbose_level = 3 self.options.verbose_level = 3
super(GnocchiShell, self).configure_logging() super(AodhShell, self).configure_logging()
root_logger = logging.getLogger('') root_logger = logging.getLogger('')
# Set logging to the requested level # Set logging to the requested level
@ -206,4 +206,4 @@ class GnocchiShell(app.App):
def main(args=None): def main(args=None):
if args is None: if args is None:
args = sys.argv[1:] args = sys.argv[1:]
return GnocchiShell().run(args) return AodhShell().run(args)

View File

@ -21,23 +21,23 @@ from tempest_lib.cli import base
from tempest_lib import exceptions from tempest_lib import exceptions
class GnocchiClient(object): class AodhClient(object):
"""Gnocchi Client for tempest-lib """Aodh Client for tempest-lib
This client doesn't use any authentication system This client doesn't use any authentication system
""" """
def __init__(self): def __init__(self):
self.cli_dir = os.environ.get('GNOCCHI_CLIENT_EXEC_DIR') self.cli_dir = os.environ.get('AODH_CLIENT_EXEC_DIR')
self.endpoint = os.environ.get('GNOCCHI_ENDPOINT') self.endpoint = os.environ.get('AODH_ENDPOINT')
self.user_id = str(uuid.uuid4()) self.user_id = str(uuid.uuid4())
self.project_id = str(uuid.uuid4()) self.project_id = str(uuid.uuid4())
def gnocchi(self, action, flags='', params='', def aodh(self, action, flags='', params='',
fail_ok=False, merge_stderr=False): fail_ok=False, merge_stderr=False):
creds = ("--os-auth-plugin gnocchi-noauth " creds = ("--os-auth-plugin aodh-noauth "
"--user-id %s --project-id %s " "--user-id %s --project-id %s "
"--gnocchi-endpoint %s") % (self.user_id, "--aodh-endpoint %s") % (self.user_id,
self.project_id, self.project_id,
self.endpoint) self.endpoint)
@ -45,10 +45,10 @@ class GnocchiClient(object):
# FIXME(sileht): base.execute is broken in py3 in tempest-lib # FIXME(sileht): base.execute is broken in py3 in tempest-lib
# see: https://review.openstack.org/#/c/218870/ # see: https://review.openstack.org/#/c/218870/
# return base.execute("gnocchi", action, flags, params, fail_ok, # return base.execute("aodh", action, flags, params, fail_ok,
# merge_stderr, self.cli_dir) # merge_stderr, self.cli_dir)
cmd = "gnocchi" cmd = "aodh"
# from fixed tempestlib # from fixed tempestlib
cmd = ' '.join([os.path.join(self.cli_dir, cmd), cmd = ' '.join([os.path.join(self.cli_dir, cmd),
@ -74,26 +74,26 @@ class GnocchiClient(object):
class ClientTestBase(base.ClientTestBase): class ClientTestBase(base.ClientTestBase):
"""Base class for gnocchiclient tests. """Base class for aodhclient tests.
Establishes the gnocchi client and retrieves the essential environment Establishes the aodhclient and retrieves the essential environment
information. information.
""" """
def _get_clients(self): def _get_clients(self):
return GnocchiClient() return AodhClient()
def retry_gnocchi(self, retry, *args, **kwargs): def retry_aodh(self, retry, *args, **kwargs):
result = "" result = ""
while not result.strip() and retry > 0: while not result.strip() and retry > 0:
result = self.gnocchi(*args, **kwargs) result = self.aodh(*args, **kwargs)
if not result: if not result:
time.sleep(1) time.sleep(1)
retry -= 1 retry -= 1
return result return result
def gnocchi(self, *args, **kwargs): def aodh(self, *args, **kwargs):
return self.clients.gnocchi(*args, **kwargs) return self.clients.aodh(*args, **kwargs)
def details_multiple(self, output_lines, with_label=False): def details_multiple(self, output_lines, with_label=False):
"""Return list of dicts with item details from cli output tables. """Return list of dicts with item details from cli output tables.

View File

@ -14,7 +14,7 @@
from oslotest import base from oslotest import base
from gnocchiclient import utils from aodhclient import utils
class SearchQueryBuilderTest(base.BaseTestCase): class SearchQueryBuilderTest(base.BaseTestCase):

View File

@ -13,24 +13,24 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from gnocchiclient import client from aodhclient import client
from gnocchiclient.v1 import archive_policy from aodhclient.v1 import archive_policy
from gnocchiclient.v1 import archive_policy_rule from aodhclient.v1 import archive_policy_rule
from gnocchiclient.v1 import capabilities from aodhclient.v1 import capabilities
from gnocchiclient.v1 import metric from aodhclient.v1 import metric
from gnocchiclient.v1 import resource from aodhclient.v1 import resource
from gnocchiclient.v1 import status from aodhclient.v1 import status
class Client(object): class Client(object):
"""Client for the Gnocchi v1 API. """Client for the Aodh v2 API.
:param string session: session :param string session: session
:type session: :py:class:`keystoneauth.adapter.Adapter` :type session: :py:class:`keystoneauth.adapter.Adapter`
""" """
def __init__(self, session=None, service_type='metric', **kwargs): def __init__(self, session=None, service_type='metric', **kwargs):
"""Initialize a new client for the Gnocchi v1 API.""" """Initialize a new client for the Aodh v2 API."""
self.api = client.SessionClient(session, service_type=service_type, self.api = client.SessionClient(session, service_type=service_type,
**kwargs) **kwargs)
self.resource = resource.ResourceManager(self) self.resource = resource.ResourceManager(self)

View File

@ -1,19 +1,19 @@
The :mod:`gnocchiclient` Python API The :mod:`aodhclient` Python API
=================================== ================================
.. module:: gnocchiclient .. module:: aodhclient
:synopsis: A client for the Gnocchi API. :synopsis: A client for the Aodh API.
.. currentmodule:: gnocchiclient .. currentmodule:: aodhclient
Usage Usage
----- -----
To use gnocchiclient in a project:: To use aodhclient in a project::
>>> from gnocchiclient.v1 import client >>> from aodhclient.v1 import client
>>> gnocchi = client.Client(...) >>> aodh = client.Client(...)
>>> gnocchi.resource.list("instance") >>> aodh.alarm.list("alarm")
Reference Reference
--------- ---------

View File

@ -24,7 +24,7 @@ sys.path.insert(0, BASE_DIR)
def gen_ref(ver, title, names): def gen_ref(ver, title, names):
refdir = os.path.join(BASE_DIR, "ref") refdir = os.path.join(BASE_DIR, "ref")
pkg = "gnocchiclient" pkg = "aodhclient"
if ver: if ver:
pkg = "%s.%s" % (pkg, ver) pkg = "%s.%s" % (pkg, ver)
refdir = os.path.join(refdir, ver) refdir = os.path.join(refdir, ver)
@ -79,7 +79,7 @@ source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
project = u'gnocchiclient' project = u'aodhclient'
copyright = u'2015, OpenStack Foundation' copyright = u'2015, OpenStack Foundation'
# If true, '()' will be appended to :func: etc. cross-reference text. # If true, '()' will be appended to :func: etc. cross-reference text.

View File

@ -1,23 +1,23 @@
.. gnocchiclient documentation master file, created by .. aodhclient documentation master file, created by
sphinx-quickstart on Tue Jul 9 22:26:36 2013. sphinx-quickstart on Tue Jul 9 22:26:36 2013.
You can adapt this file completely to your liking, but it should at least You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive. contain the root `toctree` directive.
Python bindings to the Gnocchi API Python bindings to the Aodh API
======================================================== ===============================
This is a client for gnocchi API. There's :doc:`a Python API This is a client for Aodh API. There's :doc:`a Python API
<api>` (the :mod:`gnocchiclient` module), and a :doc:`command-line script <api>` (the :mod:`aodhclient` module), and a :doc:`command-line script
<shell>` (installed as :program:`gnocchi`). Each implements the entire <shell>` (installed as :program:`aodh`). Each implements the entire
Gnocchi API. Aodh API.
.. seealso:: .. seealso::
You may want to read the `Gnocchi Developer Guide`__ -- the overview, at You may want to read the `Aodh Developer Guide`__ -- the overview, at
least -- to get an idea of the concepts. By understanding the concepts least -- to get an idea of the concepts. By understanding the concepts
this library should make more sense. this library should make more sense.
__ http://docs.openstack.org/developer/gnocchi/ __ http://docs.openstack.org/developer/aodh/
Contents: Contents:

View File

@ -4,4 +4,4 @@ Installation
At the command line:: At the command line::
$ pip install gnocchiclient $ pip install aodhclient

View File

@ -1,13 +1,13 @@
The :program:`gnocchi` shell utility The :program:`aodh` shell utility
========================================= =========================================
.. program:: gnocchi .. program:: aodh
.. highlight:: bash .. highlight:: bash
The :program:`gnocchi` shell utility interacts with Gnocchi API The :program:`aodh` shell utility interacts with Aodh API
from the command line. It supports the entirety of the Gnocchi API. from the command line. It supports the entirety of the Aodh API.
You'll need to provide :program:`gnocchi` with your OpenStack credentials. You'll need to provide :program:`aodh` with your OpenStack credentials.
You can do this with the :option:`--os-username`, :option:`--os-password`, You can do this with the :option:`--os-username`, :option:`--os-password`,
:option:`--os-tenant-id` and :option:`--os-auth-url` options, but it's easier to :option:`--os-tenant-id` and :option:`--os-auth-url` options, but it's easier to
just set them as environment variables: just set them as environment variables:
@ -37,28 +37,28 @@ For example, in Bash you would use::
The command line tool will attempt to reauthenticate using your provided credentials The command line tool will attempt to reauthenticate using your provided credentials
for every request. You can override this behavior by manually supplying an auth for every request. You can override this behavior by manually supplying an auth
token using :option:`--gnocchi-endpoint` and :option:`--os-auth-token`. You can alternatively token using :option:`--aodh-endpoint` and :option:`--os-auth-token`. You can alternatively
set these environment variables:: set these environment variables::
export GNOCCHI_ENDPOINT=http://gnocchi.example.org:8041 export AODH_ENDPOINT=http://aodh.example.org:8041
export OS_AUTH_PLUGIN=token export OS_AUTH_PLUGIN=token
export OS_AUTH_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155 export OS_AUTH_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155
Also, if the server doesn't support authentication, you can provide Also, if the server doesn't support authentication, you can provide
:option:`--os-auth-plugon` gnocchi-noauth, :option:`--gnocchi-endpoint`, :option:`--user-id` :option:`--os-auth-plugon` aodh-noauth, :option:`--aodh-endpoint`, :option:`--user-id`
and :option:`--project-id`. You can alternatively set these environment variables:: and :option:`--project-id`. You can alternatively set these environment variables::
export OS_AUTH_PLUGIN=gnocchi-noauth export OS_AUTH_PLUGIN=aodh-noauth
export GNOCCHI_ENDPOINT=http://gnocchi.example.org:8041 export AODH_ENDPOINT=http://aodh.example.org:8041
export GNOCCHI_USER_ID=99aae-4dc2-4fbc-b5b8-9688c470d9cc export AODH_USER_ID=99aae-4dc2-4fbc-b5b8-9688c470d9cc
export GNOCCHI_PROJECT_ID=c8d27445-48af-457c-8e0d-1de7103eae1f export AODH_PROJECT_ID=c8d27445-48af-457c-8e0d-1de7103eae1f
From there, all shell commands take the form:: From there, all shell commands take the form::
gnocchi <command> [arguments...] aodh <command> [arguments...]
Run :program:`gnocchi help` to get a full list of all possible commands, Run :program:`aodh help` to get a full list of all possible commands,
and run :program:`gnocchi help <command>` to get detailed help for that and run :program:`aodh help <command>` to get detailed help for that
command. command.
Examples Examples

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = gnocchiclient name = aodhclient
summary = Python client library for Gnocchi summary = Python client library for Aodh
description-file = description-file =
README.rst README.rst
author = OpenStack author = OpenStack
@ -20,14 +20,14 @@ classifier =
[files] [files]
packages = packages =
gnocchiclient aodhclient
[entry_points] [entry_points]
console_scripts = console_scripts =
gnocchi = gnocchiclient.shell:main aodh = aodhclient.shell:main
keystoneauth1.plugin = keystoneauth1.plugin =
gnocchi-noauth = gnocchiclient.noauth:GnocchiNoAuthLoader aodh-noauth = aodhclient.noauth:AodhNoAuthLoader
[build_sphinx] [build_sphinx]
@ -39,18 +39,18 @@ all_files = 1
upload-dir = doc/build/html upload-dir = doc/build/html
[compile_catalog] [compile_catalog]
directory = gnocchiclient/locale directory = aodhclient/locale
domain = gnocchiclient domain = aodhclient
[update_catalog] [update_catalog]
domain = gnocchiclient domain = aodhclient
output_dir = gnocchiclient/locale output_dir = aodhclient/locale
input_file = gnocchiclient/locale/gnocchiclient.pot input_file = aodhclient/locale/aodhclient.pot
[extract_messages] [extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg mapping_file = babel.cfg
output_file = gnocchiclient/locale/gnocchiclient.pot output_file = aodhclient/locale/aodhclient.pot
[wheel] [wheel]
universal = 1 universal = 1

View File

@ -14,6 +14,6 @@ tempest-lib>=0.6.1
testrepository>=0.0.18 testrepository>=0.0.18
testscenarios>=0.4 testscenarios>=0.4
testtools>=1.4.0 testtools>=1.4.0
http://tarballs.openstack.org/gnocchi/gnocchi-master.tar.gz#egg=gnocchi http://tarballs.openstack.org/aodh/aodh-master.tar.gz#egg=aodh
# FIXME(sileht): should be in gnocchi ? # FIXME(sileht): should be in aodh ?
keystonemiddleware keystonemiddleware

View File

@ -5,11 +5,11 @@ skipsdist = True
[testenv] [testenv]
usedevelop = True usedevelop = True
install_command = pip install -U --allow-external gnocchi --allow-insecure gnocchi {opts} {packages} install_command = pip install -U --allow-external aodh --allow-insecure aodh {opts} {packages}
setenv = setenv =
VIRTUAL_ENV={envdir} VIRTUAL_ENV={envdir}
GNOCCHI_CLIENT_EXEC_DIR={envdir}/bin AODH_CLIENT_EXEC_DIR={envdir}/bin
passenv = GNOCCHI_* OS_TEST_TIMEOUT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE passenv = AODH_* OS_TEST_TIMEOUT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE
deps = -r{toxinidir}/requirements.txt deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands = {toxinidir}/setup-tests.sh python setup.py test --slowest --testr-args='{posargs}' commands = {toxinidir}/setup-tests.sh python setup.py test --slowest --testr-args='{posargs}'