commit python-gnocchiclient for openSUSE:Factory
Hello community, here is the log from the commit of package python-gnocchiclient for openSUSE:Factory checked in at 2017-08-28 15:30:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-gnocchiclient (Old) and /work/SRC/openSUSE:Factory/.python-gnocchiclient.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-gnocchiclient" Mon Aug 28 15:30:26 2017 rev:4 rq:514884 version:3.1.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-gnocchiclient/python-gnocchiclient.changes 2017-02-21 13:43:29.262370051 +0100 +++ /work/SRC/openSUSE:Factory/.python-gnocchiclient.new/python-gnocchiclient.changes 2017-08-28 15:30:30.532199394 +0200 @@ -1,0 +2,16 @@ +Mon Aug 7 09:07:24 UTC 2017 - cloud-devel@suse.de + +- update to version 3.1.1 + - Fix data display when listing resources + - Use new keystoneauth1 helper + - shell: make client works with default Gnocchi installation + - Stop always encoding resource + - doc: Add authentication examples + - Trivial: remove support for py34 + - docs: Add all commands help + - allow to pass session and adapter options + - add note when using OS_AUTH_TYPE + - Remove pbr cap + - exceptions: make sure resource type not found is checked before resource not found + +------------------------------------------------------------------- Old: ---- gnocchiclient-2.8.2.tar.gz New: ---- gnocchiclient-3.1.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-gnocchiclient.spec ++++++ --- /var/tmp/diff_new_pack.TNuGSo/_old 2017-08-28 15:30:31.748028472 +0200 +++ /var/tmp/diff_new_pack.TNuGSo/_new 2017-08-28 15:30:31.772025098 +0200 @@ -18,7 +18,7 @@ %global sname gnocchiclient Name: python-gnocchiclient -Version: 2.8.2 +Version: 3.1.1 Release: 0 Summary: Python API and CLI for OpenStack Gnocchi License: Apache-2.0 @@ -26,25 +26,32 @@ Url: https://github.com/openstack/python-gnocchiclient Source0: https://pypi.io/packages/source/g/%{sname}/%{sname}-%{version}.tar.gz BuildRequires: openstack-macros +BuildRequires: python-cliff >= 2.6.0 BuildRequires: python-devel BuildRequires: python-futurist >= 0.11.0 -BuildRequires: python-keystoneauth1 >= 2.17.0 +BuildRequires: python-keystoneauth1 >= 2.21.0 +BuildRequires: python-openstack-doc-tools >= 1.4.0 +BuildRequires: python-osc-lib >= 1.5.1 +BuildRequires: python-oslo.serialization >= 1.10.0 +BuildRequires: python-oslo.utils >= 3.20.0 BuildRequires: python-oslotest >= 1.10.0 -BuildRequires: python-pbr >= 1.8 -BuildRequires: python-pyparsing >= 2.0.7 +BuildRequires: python-pbr >= 2.0.0 +BuildRequires: python-pyparsing >= 2.1.0 BuildRequires: python-python-subunit >= 0.0.18 -BuildRequires: python-requests >= 2.10.0 +BuildRequires: python-requests >= 2.14.2 BuildRequires: python-setuptools >= 16.0 +BuildRequires: python-six >= 1.9.0 BuildRequires: python-testrepository >= 0.0.18 BuildRequires: python-testtools >= 1.4.0 -Requires: python-cliff >= 2.3.0 +Requires: python-cliff >= 2.6.0 Requires: python-futurist >= 0.11.0 -Requires: python-keystoneauth1 >= 2.17.0 -Requires: python-osc-lib >= 1.2.0 +Requires: python-keystoneauth1 >= 2.21.0 +Requires: python-openstack-doc-tools >= 1.4.0 +Requires: python-osc-lib >= 1.5.1 Requires: python-oslo.serialization >= 1.10.0 -Requires: python-oslo.utils >= 3.18.0 -Requires: python-pbr >= 1.8 -Requires: python-pyparsing >= 2.0.7 +Requires: python-oslo.utils >= 3.20.0 +Requires: python-pbr >= 2.0.0 +Requires: python-pyparsing >= 2.1.0 Requires: python-six >= 1.9.0 BuildArch: noarch @@ -75,9 +82,13 @@ %install %py2_install +# Some env variables required to successfully build our doc +export PATH=$PATH:%{buildroot}%{_bindir} +export PYTHONPATH=. +export LANG=en_US.utf8 %{__python2} setup.py build_sphinx # Fix hidden-file-or-dir warnings -rm -rf html/.doctrees html/.buildinfo +rm -rf doc/build/html/.doctrees doc/build/html/.buildinfo %check # FIXME: only run unittests for now. Functional tests need gnocchi ++++++ _service ++++++ --- /var/tmp/diff_new_pack.TNuGSo/_old 2017-08-28 15:30:31.860012728 +0200 +++ /var/tmp/diff_new_pack.TNuGSo/_new 2017-08-28 15:30:31.872011042 +0200 @@ -1,8 +1,8 @@ <services> <service mode="disabled" name="renderspec"> - <param name="input-template">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/ocata/openstack/gnocchiclient/gnocchiclient.spec.j2</param> + <param name="input-template">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/pike/openstack/gnocchiclient/gnocchiclient.spec.j2</param> <param name="output-name">python-gnocchiclient.spec</param> - <param name="requirements">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/ocata/global-requirements.txt</param> + <param name="requirements">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/pike/global-requirements.txt</param> <param name="changelog-email">cloud-devel@suse.de</param> <param name="changelog-provider">gh,openstack,python-gnocchiclient</param> </service> ++++++ gnocchiclient-2.8.2.tar.gz -> gnocchiclient-3.1.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/ChangeLog new/gnocchiclient-3.1.1/ChangeLog --- old/gnocchiclient-2.8.2/ChangeLog 2017-01-17 14:17:35.000000000 +0100 +++ new/gnocchiclient-3.1.1/ChangeLog 2017-03-01 23:28:03.000000000 +0100 @@ -1,6 +1,28 @@ CHANGES ======= +3.1.1 +----- + +* Remove pbr cap +* doc: Add authentication examples +* Trivial: remove support for py34 + +3.1.0 +----- + +* exceptions: make sure resource type not found is checked before resource not found +* allow to pass session and adapter options +* Use new keystoneauth1 helper + +3.0.0 +----- + +* Fix data display when listing resources +* shell: make client works with default Gnocchi installation +* add note when using OS_AUTH_TYPE +* docs: Add all commands help + 2.8.2 ----- @@ -15,6 +37,7 @@ ----- * resource: Set correct attribute type +* Stop always encoding resource * support fill option * Add support for basic authentication * [doc] Note lack of constraints is a choice diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/PKG-INFO new/gnocchiclient-3.1.1/PKG-INFO --- old/gnocchiclient-2.8.2/PKG-INFO 2017-01-17 14:17:36.000000000 +0100 +++ new/gnocchiclient-3.1.1/PKG-INFO 2017-03-01 23:28:03.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: gnocchiclient -Version: 2.8.2 +Version: 3.1.1 Summary: Python client library for Gnocchi Home-page: http://docs.openstack.org/developer/python-gnocchiclient/ Author: OpenStack @@ -33,5 +33,4 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/doc/source/api.rst new/gnocchiclient-3.1.1/doc/source/api.rst --- old/gnocchiclient-2.8.2/doc/source/api.rst 2017-01-17 14:15:49.000000000 +0100 +++ new/gnocchiclient-3.1.1/doc/source/api.rst 2017-03-01 23:26:34.000000000 +0100 @@ -11,9 +11,27 @@ To use gnocchiclient in a project:: + >>> from gnocchiclient import auth >>> from gnocchiclient.v1 import client - >>> gnocchi = client.Client(...) - >>> gnocchi.resource.list("instance") + >>> + >>> auth_plugin = auth.GnocchiBasicPlugin(user="admin", + >>> endpoint="http://localhost:8041") + >>> gnocchi = client.Client(session_options={'auth': auth_plugin}) + >>> gnocchi.resource.list("generic") + +With authentication from a keystoneauth1 plugins:: + + >>> from keystoneauth1 import loading + >>> from oslo_config import cfg + >>> from gnocchiclient import auth + >>> from gnocchiclient.v1 import client + >>> + >>> conf = cfg.ConfigOpts() + >>> ... + >>> auth_plugin = loading.load_auth_from_conf_options(conf, "gnocchi_credentials") + >>> gnocchi = client.Client(session_options={'auth': auth_plugin}) + >>> gnocchi.resource.list("generic") + Reference --------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/doc/source/conf.py new/gnocchiclient-3.1.1/doc/source/conf.py --- old/gnocchiclient-2.8.2/doc/source/conf.py 2017-01-17 14:15:49.000000000 +0100 +++ new/gnocchiclient-3.1.1/doc/source/conf.py 2017-03-01 23:26:34.000000000 +0100 @@ -26,6 +26,7 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ + 'gnocchiclient.gendoc', 'sphinx.ext.autodoc', #'sphinx.ext.intersphinx' ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/doc/source/shell.rst new/gnocchiclient-3.1.1/doc/source/shell.rst --- old/gnocchiclient-2.8.2/doc/source/shell.rst 2017-01-17 14:15:49.000000000 +0100 +++ new/gnocchiclient-3.1.1/doc/source/shell.rst 2017-03-01 23:26:34.000000000 +0100 @@ -7,6 +7,9 @@ The :program:`gnocchi` shell utility interacts with Gnocchi from the command line. It supports the entirety of the Gnocchi API. +Authentication method ++++++++++++++++++++++ + You'll need to provide the authentication method and your credentials to :program:`gnocchi`. @@ -41,16 +44,28 @@ export GNOCCHI_PROJECT_ID=<yourprojectid> export GNOCCHI_ENDPOINT=http://urlofgnocchi +.. note:: + + OS_AUTH_TYPE is used globally by all clients supporting Keystone. Provide + :option:`--os-auth-plugin` gnocchi-noauth to the client instead if other + clients are used in session. + Basic authentication ~~~~~~~~~~~~~~~~~~~~ -If you're using Gnocchi with basic authentication, export the following variables -in your environment:: +If you're using Gnocchi with basic authentication, export the following +variables in your environment:: export OS_AUTH_TYPE=gnocchi-basic export GNOCCHI_USER=<youruserid> export GNOCCHI_ENDPOINT=http://urlofgnocchi +.. note:: + + OS_AUTH_TYPE is used globally by all clients supporting Keystone. Provide + :option:`--os-auth-plugin` gnocchi-basic to the client instead if other + clients are used in session. + OpenStack Keystone authentication ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -72,38 +87,8 @@ export OS_AUTH_PLUGIN=token export OS_AUTH_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155 -Also, if the server doesn't support authentication, you can provide -:option:`--os-auth-plugin` gnocchi-noauth, :option:`--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 - -Usage -===== - -Once authentication is set up, all shell commands take the form:: - - gnocchi <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 -command. - -Examples --------- - -Create a resource:: - - gnocchi resource create --attribute id:5a301761-f78b-46e2-8900-8b4f6fe6675a --attribute project_id:eba5c38f-c3dd-4d9c-9235-32d430471f94 -n temperature:high instance - -List resources:: - - gnocchi resource list --type instance -Search of resources:: +Commands descriptions ++++++++++++++++++++++ - gnocchi resource search "project_id='5a301761-f78b-46e2-8900-8b4f6fe6675a' and type=instance" +.. include:: gnocchi.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/gnocchiclient/auth.py new/gnocchiclient-3.1.1/gnocchiclient/auth.py --- old/gnocchiclient-2.8.2/gnocchiclient/auth.py 2017-01-17 14:15:49.000000000 +0100 +++ new/gnocchiclient-3.1.1/gnocchiclient/auth.py 2017-03-01 23:26:34.000000000 +0100 @@ -107,9 +107,11 @@ options = super(GnocchiBasicLoader, self).get_options() options.extend([ GnocchiOpt('user', help='User', required=True, + default="admin", metavar="<gnocchi user>"), GnocchiOpt('endpoint', help='Gnocchi endpoint', dest="endpoint", required=True, + default="http://localhost:8041", metavar="<gnocchi endpoint>"), ]) return options diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/gnocchiclient/exceptions.py new/gnocchiclient-3.1.1/gnocchiclient/exceptions.py --- old/gnocchiclient-2.8.2/gnocchiclient/exceptions.py 2017-01-17 14:15:49.000000000 +0100 +++ new/gnocchiclient-3.1.1/gnocchiclient/exceptions.py 2017-03-01 23:26:34.000000000 +0100 @@ -171,8 +171,8 @@ MethodNotAllowed, NotAcceptable, Conflict, OverLimit, RateLimit, NotImplemented] _error_classes_enhanced = { - NotFound: [MetricNotFound, ResourceNotFound, ArchivePolicyRuleNotFound, - ArchivePolicyNotFound, ResourceTypeNotFound], + NotFound: [MetricNotFound, ResourceTypeNotFound, ResourceNotFound, + ArchivePolicyRuleNotFound, ArchivePolicyNotFound], Conflict: [NamedMetricAlreadyExists, ResourceAlreadyExists, ArchivePolicyAlreadyExists, ArchivePolicyRuleAlreadyExists] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/gnocchiclient/gendoc.py new/gnocchiclient-3.1.1/gnocchiclient/gendoc.py --- old/gnocchiclient-2.8.2/gnocchiclient/gendoc.py 1970-01-01 01:00:00.000000000 +0100 +++ new/gnocchiclient-3.1.1/gnocchiclient/gendoc.py 2017-03-01 23:26:34.000000000 +0100 @@ -0,0 +1,36 @@ +# -*- encoding: utf-8 -*- +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import + +from os_doc_tools import commands + +# HACK(jd) Not sure why but Sphinx setup this multiple times, so we just avoid +# doing several times the requests by using this global variable :( +_RUN = False + + +def setup(app): + global _RUN + if _RUN: + return + commands.document_single_project("gnocchi", "doc/source", False) + with open("doc/source/gnocchi.rst", "r") as f: + data = f.read().splitlines(True) + for index, line in enumerate(data): + if "This chapter documents" in line: + break + with open("doc/source/gnocchi.rst", "w") as f: + f.writelines(data[index+1:]) + _RUN = True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/gnocchiclient/shell.py new/gnocchiclient-3.1.1/gnocchiclient/shell.py --- old/gnocchiclient-2.8.2/gnocchiclient/shell.py 2017-01-17 14:15:49.000000000 +0100 +++ new/gnocchiclient-3.1.1/gnocchiclient/shell.py 2017-03-01 23:26:34.000000000 +0100 @@ -20,6 +20,7 @@ from cliff import app from cliff import commandmanager +from keystoneauth1 import adapter from keystoneauth1 import exceptions from keystoneauth1 import loading @@ -110,36 +111,28 @@ description, version, argparse_kwargs={'allow_abbrev': False}) - # Global arguments, one day this should go to keystoneauth1 - parser.add_argument( - '--os-region-name', - metavar='<auth-region-name>', - dest='region_name', - default=os.environ.get('OS_REGION_NAME'), - help='Authentication region name (Env: OS_REGION_NAME)') - parser.add_argument( - '--os-interface', - metavar='<interface>', - dest='interface', - choices=['admin', 'public', 'internal'], - default=os.environ.get('OS_INTERFACE'), - help='Select an interface type.' - ' Valid interface types: [admin, public, internal].' - ' (Env: OS_INTERFACE)') parser.add_argument( '--gnocchi-api-version', default=os.environ.get('GNOCCHI_API_VERSION', '1'), help='Defaults to env[GNOCCHI_API_VERSION] or 1.') + loading.register_session_argparse_arguments(parser=parser) plugin = loading.register_auth_argparse_arguments( - parser=parser, argv=sys.argv, default="password") + parser=parser, argv=sys.argv, default="gnocchi-basic") if not isinstance(plugin, (auth.GnocchiNoAuthLoader, auth.GnocchiBasicLoader)): + adapter.register_adapter_argparse_arguments( + parser=parser, service_type="metric") + adapter.register_service_adapter_argparse_arguments( + parser=parser, service_type="metric") + parser.add_argument( '--endpoint', default=os.environ.get('GNOCCHI_ENDPOINT'), - help='Gnocchi endpoint (Env: GNOCCHI_ENDPOINT)') + help='Gnocchi endpoint (Env: GNOCCHI_ENDPOINT). ' + 'Deprecated, use --os-endpoint-override and ' + 'OS_ENDPOINT_OVERRIDE instead') return parser @@ -148,20 +141,40 @@ # NOTE(sileht): we lazy load the client to not # load/connect auth stuffs if self._client is None: - if hasattr(self.options, "endpoint"): - endpoint_override = self.options.endpoint - else: - endpoint_override = None auth_plugin = loading.load_auth_from_argparse_arguments( self.options) session = loading.load_session_from_argparse_arguments( self.options, auth=auth_plugin) - self._client = client.Client(self.options.gnocchi_api_version, - session=session, - interface=self.options.interface, - region_name=self.options.region_name, - endpoint_override=endpoint_override) + if isinstance(auth_plugin, (auth.GnocchiNoAuthPlugin, + auth.GnocchiBasicPlugin)): + # Normal endpoint + kwargs = dict( + version=self.options.gnocchi_api_version, + session=session, + ) + else: + # Openstck style endpoint + kwargs = dict( + version=(self.options.os_metric_api_version or + self.options.os_api_version or + self.options.gnocchi_api_version), + session=session, + adapter_options=dict( + service_type=(self.options.os_metric_service_type or + self.options.os_service_type), + service_name=(self.options.os_metric_service_name or + self.options.os_service_name), + interface=(self.options.os_metric_interface or + self.options.os_interface), + region_name=self.options.os_region_name, + endpoint_override=( + self.options.os_metric_endpoint_override or + self.options.os_endpoint_override or + self.options.endpoint), + ) + ) + self._client = client.Client(**kwargs) return self._client def clean_up(self, cmd, result, err): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/gnocchiclient/tests/functional/test_resource.py new/gnocchiclient-3.1.1/gnocchiclient/tests/functional/test_resource.py --- old/gnocchiclient-2.8.2/gnocchiclient/tests/functional/test_resource.py 2017-01-17 14:15:49.000000000 +0100 +++ new/gnocchiclient-3.1.1/gnocchiclient/tests/functional/test_resource.py 2017-03-01 23:26:34.000000000 +0100 @@ -13,14 +13,11 @@ from oslo_utils import uuidutils from gnocchiclient.tests.functional import base -from gnocchiclient import utils class ResourceClientTest(base.ClientTestBase): RESOURCE_ID = uuidutils.generate_uuid() - RESOURCE_ID2 = uuidutils.generate_uuid() - RAW_RESOURCE_ID2 = uuidutils.generate_uuid() + "/foo" - RESOURCE_ID2 = utils.encode_resource_id(RAW_RESOURCE_ID2) + RESOURCE_ID2 = "foo" PROJECT_ID = uuidutils.generate_uuid() def test_help(self): @@ -123,10 +120,9 @@ result = self.gnocchi( 'resource', params=("create %s -t generic " "-a project_id:%s" - ) % (self.RAW_RESOURCE_ID2, self.PROJECT_ID)) + ) % (self.RESOURCE_ID2, self.PROJECT_ID)) resource2 = self.details_multiple(result)[0] - self.assertEqual(self.RESOURCE_ID2, resource2["id"]) - self.assertEqual(self.RAW_RESOURCE_ID2, + self.assertEqual(self.RESOURCE_ID2, resource2["original_resource_id"]) self.assertEqual(self.PROJECT_ID, resource2["project_id"]) self.assertNotEqual('None', resource2["started_at"]) @@ -141,7 +137,8 @@ "--limit 1" ) % (self.PROJECT_ID, self.RESOURCE_ID)) resource_limit = self.parser.listing(result)[0] - self.assertEqual(self.RESOURCE_ID2, resource_limit["id"]) + self.assertEqual(self.RESOURCE_ID2, + resource_limit["original_resource_id"]) self.assertEqual(self.PROJECT_ID, resource_limit["project_id"]) self.assertEqual(resource2["started_at"], resource_limit["started_at"]) @@ -180,7 +177,7 @@ resource1 = self.details_multiple(result1)[0] resource2 = self.details_multiple(result2)[0] self.assertEqual(self.RESOURCE_ID, resource1['id']) - self.assertEqual(self.RESOURCE_ID2, resource2['id']) + self.assertEqual(self.RESOURCE_ID2, resource2['original_resource_id']) result3 = self.gnocchi( 'resource batch delete ', params=("'id in [%s, %s]' " diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/gnocchiclient/tests/unit/test_exceptions.py new/gnocchiclient-3.1.1/gnocchiclient/tests/unit/test_exceptions.py --- old/gnocchiclient-2.8.2/gnocchiclient/tests/unit/test_exceptions.py 2017-01-17 14:15:49.000000000 +0100 +++ new/gnocchiclient-3.1.1/gnocchiclient/tests/unit/test_exceptions.py 2017-03-01 23:26:34.000000000 +0100 @@ -30,6 +30,16 @@ exc = exceptions.from_response(r) self.assertIsInstance(exc, exceptions.ArchivePolicyRuleNotFound) + def test_resource_type_before_resource(self): + r = models.Response() + r.status_code = 404 + r.headers['Content-Type'] = "application/json" + r._content = json.dumps( + {"description": "Resource type foobar does not exist"} + ).encode('utf-8') + exc = exceptions.from_response(r) + self.assertIsInstance(exc, exceptions.ResourceTypeNotFound) + def test_from_response_keystone_401(self): r = models.Response() r.status_code = 401 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/gnocchiclient/utils.py new/gnocchiclient-3.1.1/gnocchiclient/utils.py --- old/gnocchiclient-2.8.2/gnocchiclient/utils.py 2017-01-17 14:15:49.000000000 +0100 +++ new/gnocchiclient-3.1.1/gnocchiclient/utils.py 2017-03-01 23:26:34.000000000 +0100 @@ -12,8 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -import uuid - import pyparsing as pp import six from six.moves.urllib import parse as urllib_parse @@ -217,27 +215,6 @@ return "%s" % "&".join(options) -# uuid5 namespace for id transformation. -# NOTE(chdent): This UUID must stay the same, forever, across all -# of gnocchi to preserve its value as a URN namespace. -RESOURCE_ID_NAMESPACE = uuid.UUID('0a7a15ff-aa13-4ac2-897c-9bdf30ce175b') - - -def encode_resource_id(value): - try: - try: - return str(uuid.UUID(value)) - except ValueError: - if len(value) <= 255: - if six.PY2: - value = value.encode('utf-8') - return str(uuid.uuid5(RESOURCE_ID_NAMESPACE, value)) - raise ValueError( - 'transformable resource id >255 max allowed characters') - except Exception as e: - raise ValueError(e) - - def get_client(obj): if hasattr(obj.app, 'client_manager'): # NOTE(sileht): cliff objects loaded by OSC diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/gnocchiclient/v1/client.py new/gnocchiclient-3.1.1/gnocchiclient/v1/client.py --- old/gnocchiclient-2.8.2/gnocchiclient/v1/client.py 2017-01-17 14:15:49.000000000 +0100 +++ new/gnocchiclient-3.1.1/gnocchiclient/v1/client.py 2017-03-01 23:26:34.000000000 +0100 @@ -13,6 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. +import debtcollector +from debtcollector import removals +import keystoneauth1.session + from gnocchiclient import client from gnocchiclient.v1 import archive_policy from gnocchiclient.v1 import archive_policy_rule @@ -26,14 +30,46 @@ class Client(object): """Client for the Gnocchi v1 API. - :param string session: session - :type session: :py:class:`keystoneauth.adapter.Adapter` + :param session: keystoneauth1 session + :type session: :py:class:`keystoneauth1.session.Session` (optional) + :param adapter_options: options to pass to + :py:class:`keystoneauth1.adapter.Adapter` + :type adapter_options: dict (optional) + :param session_options: options to pass to + :py:class:`keystoneauth1.session.Session` + :type session_options: dict (optional) """ - def __init__(self, session=None, service_type='metric', **kwargs): + @removals.removed_kwarg('service_type', + message="Please use 'adapter_options=" + "dict(service_type=...)' instead") + def __init__(self, session=None, service_type=None, + adapter_options=None, session_options=None, + **kwargs): """Initialize a new client for the Gnocchi v1 API.""" - self.api = client.SessionClient(session, service_type=service_type, - **kwargs) + session_options = session_options or {} + adapter_options = adapter_options or {} + + adapter_options.setdefault('service_type', "metric") + + # NOTE(sileht): Backward compat stuff + if kwargs: + for key in kwargs: + debtcollector.deprecate( + "Using the '%s' argument is deprecated" % key, + message="Please use 'adapter_options=dict(%s=...)' " + "instead" % key) + adapter_options.update(kwargs) + if service_type is not None: + adapter_options['service_type'] = service_type + + if session is None: + session = keystoneauth1.session.Session(**session_options) + else: + if session_options: + raise ValueError("session and session_options are exclusive") + + self.api = client.SessionClient(session, **adapter_options) self.resource = resource.ResourceManager(self) self.resource_type = resource_type.ResourceTypeManager(self) self.archive_policy = archive_policy.ArchivePolicyManager(self) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/gnocchiclient/v1/metric.py new/gnocchiclient-3.1.1/gnocchiclient/v1/metric.py --- old/gnocchiclient-2.8.2/gnocchiclient/v1/metric.py 2017-01-17 14:15:49.000000000 +0100 +++ new/gnocchiclient-3.1.1/gnocchiclient/v1/metric.py 2017-03-01 23:26:34.000000000 +0100 @@ -64,7 +64,6 @@ self._ensure_metric_is_uuid(metric) url = self.metric_url + metric else: - resource_id = utils.encode_resource_id(resource_id) url = (self.resource_url % resource_id) + metric return self._get(url).json() @@ -93,7 +92,6 @@ raise TypeError("metric_name is required if resource_id is set") del metric['resource_id'] - resource_id = utils.encode_resource_id(resource_id) metric = {metric_name: metric} metric = self._post( self.resource_url % resource_id, @@ -114,7 +112,6 @@ self._ensure_metric_is_uuid(metric) url = self.metric_url + metric else: - resource_id = utils.encode_resource_id(resource_id) url = self.resource_url % resource_id + metric self._delete(url) @@ -133,7 +130,6 @@ self._ensure_metric_is_uuid(metric) url = self.metric_url + metric + "/measures" else: - resource_id = utils.encode_resource_id(resource_id) url = self.resource_url % resource_id + metric + "/measures" return self._post( url, headers={'Content-Type': "application/json"}, @@ -205,7 +201,6 @@ self._ensure_metric_is_uuid(metric) url = self.metric_url + metric + "/measures" else: - resource_id = utils.encode_resource_id(resource_id) url = self.resource_url % resource_id + metric + "/measures" return self._get(url, params=params).json() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/gnocchiclient/v1/resource.py new/gnocchiclient-3.1.1/gnocchiclient/v1/resource.py --- old/gnocchiclient-2.8.2/gnocchiclient/v1/resource.py 2017-01-17 14:15:49.000000000 +0100 +++ new/gnocchiclient-3.1.1/gnocchiclient/v1/resource.py 2017-03-01 23:26:34.000000000 +0100 @@ -55,7 +55,6 @@ :type history: bool """ history = "/history" if history else "" - resource_id = utils.encode_resource_id(resource_id) url = self.url + "%s/%s%s" % (resource_type, resource_id, history) return self._get(url).json() @@ -80,7 +79,6 @@ """ qs = utils.build_pagination_options(details, False, limit, marker, sorts) - resource_id = utils.encode_resource_id(resource_id) url = "%s%s/%s/history?%s" % (self.url, resource_type, resource_id, qs) return self._get(url).json() @@ -107,8 +105,6 @@ :param resource: Attribute of the resource :type resource: dict """ - - resource_id = utils.encode_resource_id(resource_id) return self._patch( self.url + resource_type + "/" + resource_id, headers={'Content-Type': "application/json"}, @@ -120,7 +116,6 @@ :param resource_id: ID of the resource :type resource_id: str """ - resource_id = utils.encode_resource_id(resource_id) self._delete(self.url + "generic/" + resource_id) def batch_delete(self, query, resource_type="generic"): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/gnocchiclient/v1/resource_cli.py new/gnocchiclient-3.1.1/gnocchiclient/v1/resource_cli.py --- old/gnocchiclient-2.8.2/gnocchiclient/v1/resource_cli.py 2017-01-17 14:15:49.000000000 +0100 +++ new/gnocchiclient-3.1.1/gnocchiclient/v1/resource_cli.py 2017-03-01 23:26:34.000000000 +0100 @@ -49,11 +49,27 @@ default="generic", help="Type of resource") return parser + def _list2cols(self, resources): + """Return a formatted list of resources.""" + if not resources: + return self.COLS, [] + cols = list(self.COLS) + for k in resources[0]: + if k not in cols: + cols.append(k) + if 'creator' in cols: + cols.remove('created_by_user_id') + cols.remove('created_by_project_id') + return utils.list2cols(cols, resources) + def take_action(self, parsed_args): resources = utils.get_client(self).resource.list( resource_type=parsed_args.resource_type, **utils.get_pagination_options(parsed_args)) - return utils.list2cols(self.COLS, resources) + # Do not dump metrics because it makes the list way too long + for r in resources: + del r['metrics'] + return self._list2cols(resources) class CliResourceHistory(CliResourceList): @@ -71,10 +87,9 @@ resource_type=parsed_args.resource_type, resource_id=parsed_args.resource_id, **utils.get_pagination_options(parsed_args)) - cols = resources[0].keys() if resources else self.COLS if parsed_args.formatter == 'table': - return utils.list2cols(cols, map(normalize_metrics, resources)) - return utils.list2cols(cols, resources) + return self._list2cols(list(map(normalize_metrics, resources))) + return self._list2cols(resources) class CliResourceSearch(CliResourceList): @@ -90,7 +105,10 @@ resource_type=parsed_args.resource_type, query=parsed_args.query, **utils.get_pagination_options(parsed_args)) - return utils.list2cols(self.COLS, resources) + # Do not dump metrics because it makes the list way too long + for r in resources: + del r['metrics'] + return self._list2cols(resources) def normalize_metrics(res): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/gnocchiclient.egg-info/PKG-INFO new/gnocchiclient-3.1.1/gnocchiclient.egg-info/PKG-INFO --- old/gnocchiclient-2.8.2/gnocchiclient.egg-info/PKG-INFO 2017-01-17 14:17:35.000000000 +0100 +++ new/gnocchiclient-3.1.1/gnocchiclient.egg-info/PKG-INFO 2017-03-01 23:28:03.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: gnocchiclient -Version: 2.8.2 +Version: 3.1.1 Summary: Python client library for Gnocchi Home-page: http://docs.openstack.org/developer/python-gnocchiclient/ Author: OpenStack @@ -33,5 +33,4 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/gnocchiclient.egg-info/SOURCES.txt new/gnocchiclient-3.1.1/gnocchiclient.egg-info/SOURCES.txt --- old/gnocchiclient-2.8.2/gnocchiclient.egg-info/SOURCES.txt 2017-01-17 14:17:36.000000000 +0100 +++ new/gnocchiclient-3.1.1/gnocchiclient.egg-info/SOURCES.txt 2017-03-01 23:28:03.000000000 +0100 @@ -22,6 +22,7 @@ gnocchiclient/benchmark.py gnocchiclient/client.py gnocchiclient/exceptions.py +gnocchiclient/gendoc.py gnocchiclient/osc.py gnocchiclient/shell.py gnocchiclient/utils.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/gnocchiclient.egg-info/pbr.json new/gnocchiclient-3.1.1/gnocchiclient.egg-info/pbr.json --- old/gnocchiclient-2.8.2/gnocchiclient.egg-info/pbr.json 2017-01-17 14:17:35.000000000 +0100 +++ new/gnocchiclient-3.1.1/gnocchiclient.egg-info/pbr.json 2017-03-01 23:28:03.000000000 +0100 @@ -1 +1 @@ -{"git_version": "f14fe0e", "is_release": true} \ No newline at end of file +{"git_version": "2b2e08e", "is_release": true} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/gnocchiclient.egg-info/requires.txt new/gnocchiclient-3.1.1/gnocchiclient.egg-info/requires.txt --- old/gnocchiclient-2.8.2/gnocchiclient.egg-info/requires.txt 2017-01-17 14:17:35.000000000 +0100 +++ new/gnocchiclient-3.1.1/gnocchiclient.egg-info/requires.txt 2017-03-01 23:28:03.000000000 +0100 @@ -1,15 +1,17 @@ -pbr<2.0,>=1.4 +pbr>=1.4 cliff>1.16.0 osc-lib>=0.3.0 oslo.serialization>=1.4.0 oslo.utils>=2.0.0 -keystoneauth1>=1.0.0 +keystoneauth1>=2.0.0 six futurist [doc] +doc8 sphinx!=1.2.0,!=1.3b1,>=1.1.2 oslosphinx>=2.5.0 # Apache-2.0 +openstack-doc-tools>=1.0.1 [test] coverage>=3.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/requirements.txt new/gnocchiclient-3.1.1/requirements.txt --- old/gnocchiclient-2.8.2/requirements.txt 2017-01-17 14:15:49.000000000 +0100 +++ new/gnocchiclient-3.1.1/requirements.txt 2017-03-01 23:26:34.000000000 +0100 @@ -2,11 +2,11 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -pbr<2.0,>=1.4 +pbr>=1.4 cliff>1.16.0 # Apache-2.0 osc-lib>=0.3.0 # Apache-2.0 oslo.serialization>=1.4.0 # Apache-2.0 oslo.utils>=2.0.0 # Apache-2.0 -keystoneauth1>=1.0.0 +keystoneauth1>=2.0.0 six futurist diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/setup.cfg new/gnocchiclient-3.1.1/setup.cfg --- old/gnocchiclient-2.8.2/setup.cfg 2017-01-17 14:17:36.000000000 +0100 +++ new/gnocchiclient-3.1.1/setup.cfg 2017-03-01 23:28:03.000000000 +0100 @@ -16,7 +16,6 @@ Programming Language :: Python :: 2 Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 - Programming Language :: Python :: 3.4 Programming Language :: Python :: 3.5 [files] @@ -80,8 +79,10 @@ testrepository>=0.0.18 testtools>=1.4.0 doc = + doc8 sphinx!=1.2.0,!=1.3b1,>=1.1.2 oslosphinx>=2.5.0 # Apache-2.0 + openstack-doc-tools>=1.0.1 [build_sphinx] source-dir = doc/source diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnocchiclient-2.8.2/tox.ini new/gnocchiclient-3.1.1/tox.ini --- old/gnocchiclient-2.8.2/tox.ini 2017-01-17 14:15:49.000000000 +0100 +++ new/gnocchiclient-3.1.1/tox.ini 2017-03-01 23:26:34.000000000 +0100 @@ -1,6 +1,6 @@ [tox] minversion = 1.6 -envlist = py34,py35,py27,pypy,pep8 +envlist = py35,py27,pypy,pep8 skipsdist = True [testenv] @@ -31,12 +31,15 @@ commands = rm -rf doc/source/ref python setup.py build_sphinx + doc8 --ignore-path doc/source/gnocchi.rst doc/source [testenv:docs-gnocchi.xyz] deps = .[test,doc] sphinx_rtd_theme setenv = SPHINX_HTML_THEME=sphinx_rtd_theme -commands = python setup.py build_sphinx +commands = + python setup.py build_sphinx + doc8 --ignore-path doc/source/gnocchi.rst doc/source [testenv:debug] commands = pifpaf --debug run gnocchi -- oslo_debug_helper {posargs}
participants (1)
-
root@hilbert.suse.de