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]
branch = True
source = gnocchiclient
omit = gnocchiclient/openstack/*
source = aodhclient
omit = aodhclient/openstack/*
[report]
ignore_errors = True

View File

@ -1,4 +1,4 @@
[gerrit]
host=review.openstack.org
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} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
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_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/

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

View File

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

View File

@ -35,7 +35,7 @@ from aodhclient.v1 import status_cli
from aodhclient.version import __version__
class GnocchiCommandManager(commandmanager.CommandManager):
class AodhCommandManager(commandmanager.CommandManager):
SHELL_COMMANDS = {
"status": status_cli.CliStatusShow,
"resource list": resource_cli.CliResourceList,
@ -72,13 +72,13 @@ class GnocchiCommandManager(commandmanager.CommandManager):
self.add_command(name, command_class)
class GnocchiShell(app.App):
class AodhShell(app.App):
def __init__(self):
super(GnocchiShell, self).__init__(
description='Gnocchi command line client',
super(AodhShell, self).__init__(
description='Aodh command line client',
# FIXME(sileht): get version from pbr
version=__version__,
command_manager=GnocchiCommandManager(None),
command_manager=AodhCommandManager(None),
deferred_help=True,
)
@ -95,7 +95,7 @@ class GnocchiShell(app.App):
:param version: version number for the application
:paramtype version: str
"""
parser = super(GnocchiShell, self).build_option_parser(description,
parser = super(AodhShell, self).build_option_parser(description,
version)
# Global arguments, one day this should go to keystoneauth1
parser.add_argument(
@ -115,19 +115,19 @@ class GnocchiShell(app.App):
' (Env: OS_INTERFACE)')
parser.add_argument(
'--aodh-api-version',
default=os.environ.get('GNOCCHI_API_VERSION', '1'),
help='Defaults to env[GNOCCHI_API_VERSION] or 1.')
default=os.environ.get('AODH_API_VERSION', '2'),
help='Defaults to env[AODH_API_VERSION] or 2.')
loading.register_session_argparse_arguments(parser=parser)
plugin = loading.register_auth_argparse_arguments(
parser=parser, argv=sys.argv, default="password")
if not isinstance(plugin, noauth.GnocchiNoAuthLoader):
if not isinstance(plugin, noauth.AodhNoAuthLoader):
parser.add_argument(
'--aodh-endpoint',
metavar='<endpoint>',
dest='endpoint',
default=os.environ.get('GNOCCHI_ENDPOINT'),
help='Gnocchi endpoint (Env: GNOCCHI_ENDPOINT)')
default=os.environ.get('AODH_ENDPOINT'),
help='Aodh endpoint (Env: AODH_ENDPOINT)')
return parser
@ -167,7 +167,7 @@ class GnocchiShell(app.App):
# Set this here so cliff.app.configure_logging() can work
self.options.verbose_level = 3
super(GnocchiShell, self).configure_logging()
super(AodhShell, self).configure_logging()
root_logger = logging.getLogger('')
# Set logging to the requested level
@ -206,4 +206,4 @@ class GnocchiShell(app.App):
def main(args=None):
if args is None:
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
class GnocchiClient(object):
"""Gnocchi Client for tempest-lib
class AodhClient(object):
"""Aodh Client for tempest-lib
This client doesn't use any authentication system
"""
def __init__(self):
self.cli_dir = os.environ.get('GNOCCHI_CLIENT_EXEC_DIR')
self.endpoint = os.environ.get('GNOCCHI_ENDPOINT')
self.cli_dir = os.environ.get('AODH_CLIENT_EXEC_DIR')
self.endpoint = os.environ.get('AODH_ENDPOINT')
self.user_id = str(uuid.uuid4())
self.project_id = str(uuid.uuid4())
def gnocchi(self, action, flags='', params='',
fail_ok=False, merge_stderr=False):
creds = ("--os-auth-plugin gnocchi-noauth "
def aodh(self, action, flags='', params='',
fail_ok=False, merge_stderr=False):
creds = ("--os-auth-plugin aodh-noauth "
"--user-id %s --project-id %s "
"--gnocchi-endpoint %s") % (self.user_id,
"--aodh-endpoint %s") % (self.user_id,
self.project_id,
self.endpoint)
@ -45,10 +45,10 @@ class GnocchiClient(object):
# FIXME(sileht): base.execute is broken in py3 in tempest-lib
# 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)
cmd = "gnocchi"
cmd = "aodh"
# from fixed tempestlib
cmd = ' '.join([os.path.join(self.cli_dir, cmd),
@ -74,26 +74,26 @@ class GnocchiClient(object):
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.
"""
def _get_clients(self):
return GnocchiClient()
return AodhClient()
def retry_gnocchi(self, retry, *args, **kwargs):
def retry_aodh(self, retry, *args, **kwargs):
result = ""
while not result.strip() and retry > 0:
result = self.gnocchi(*args, **kwargs)
result = self.aodh(*args, **kwargs)
if not result:
time.sleep(1)
retry -= 1
return result
def gnocchi(self, *args, **kwargs):
return self.clients.gnocchi(*args, **kwargs)
def aodh(self, *args, **kwargs):
return self.clients.aodh(*args, **kwargs)
def details_multiple(self, output_lines, with_label=False):
"""Return list of dicts with item details from cli output tables.

View File

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

View File

@ -13,24 +13,24 @@
# License for the specific language governing permissions and limitations
# under the License.
from gnocchiclient import client
from gnocchiclient.v1 import archive_policy
from gnocchiclient.v1 import archive_policy_rule
from gnocchiclient.v1 import capabilities
from gnocchiclient.v1 import metric
from gnocchiclient.v1 import resource
from gnocchiclient.v1 import status
from aodhclient import client
from aodhclient.v1 import archive_policy
from aodhclient.v1 import archive_policy_rule
from aodhclient.v1 import capabilities
from aodhclient.v1 import metric
from aodhclient.v1 import resource
from aodhclient.v1 import status
class Client(object):
"""Client for the Gnocchi v1 API.
"""Client for the Aodh v2 API.
:param string session: session
:type session: :py:class:`keystoneauth.adapter.Adapter`
"""
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,
**kwargs)
self.resource = resource.ResourceManager(self)

View File

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

View File

@ -24,7 +24,7 @@ sys.path.insert(0, BASE_DIR)
def gen_ref(ver, title, names):
refdir = os.path.join(BASE_DIR, "ref")
pkg = "gnocchiclient"
pkg = "aodhclient"
if ver:
pkg = "%s.%s" % (pkg, ver)
refdir = os.path.join(refdir, ver)
@ -79,7 +79,7 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'gnocchiclient'
project = u'aodhclient'
copyright = u'2015, OpenStack Foundation'
# 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.
You can adapt this file completely to your liking, but it should at least
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
<api>` (the :mod:`gnocchiclient` module), and a :doc:`command-line script
<shell>` (installed as :program:`gnocchi`). Each implements the entire
Gnocchi API.
This is a client for Aodh API. There's :doc:`a Python API
<api>` (the :mod:`aodhclient` module), and a :doc:`command-line script
<shell>` (installed as :program:`aodh`). Each implements the entire
Aodh API.
.. 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
this library should make more sense.
__ http://docs.openstack.org/developer/gnocchi/
__ http://docs.openstack.org/developer/aodh/
Contents:

View File

@ -4,4 +4,4 @@ Installation
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
The :program:`gnocchi` shell utility interacts with Gnocchi API
from the command line. It supports the entirety of the Gnocchi API.
The :program:`aodh` shell utility interacts with Aodh 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`,
:option:`--os-tenant-id` and :option:`--os-auth-url` options, but it's easier to
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
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::
export GNOCCHI_ENDPOINT=http://gnocchi.example.org:8041
export AODH_ENDPOINT=http://aodh.example.org:8041
export OS_AUTH_PLUGIN=token
export OS_AUTH_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155
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::
export OS_AUTH_PLUGIN=gnocchi-noauth
export GNOCCHI_ENDPOINT=http://gnocchi.example.org:8041
export GNOCCHI_USER_ID=99aae-4dc2-4fbc-b5b8-9688c470d9cc
export GNOCCHI_PROJECT_ID=c8d27445-48af-457c-8e0d-1de7103eae1f
export OS_AUTH_PLUGIN=aodh-noauth
export AODH_ENDPOINT=http://aodh.example.org:8041
export AODH_USER_ID=99aae-4dc2-4fbc-b5b8-9688c470d9cc
export AODH_PROJECT_ID=c8d27445-48af-457c-8e0d-1de7103eae1f
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,
and run :program:`gnocchi help <command>` to get detailed help for that
Run :program:`aodh help` to get a full list of all possible commands,
and run :program:`aodh help <command>` to get detailed help for that
command.
Examples

View File

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

View File

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

View File

@ -5,11 +5,11 @@ skipsdist = True
[testenv]
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 =
VIRTUAL_ENV={envdir}
GNOCCHI_CLIENT_EXEC_DIR={envdir}/bin
passenv = GNOCCHI_* OS_TEST_TIMEOUT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE
AODH_CLIENT_EXEC_DIR={envdir}/bin
passenv = AODH_* OS_TEST_TIMEOUT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = {toxinidir}/setup-tests.sh python setup.py test --slowest --testr-args='{posargs}'