From 43f63e00de138827bf980e01492f724d6c50b2c1 Mon Sep 17 00:00:00 2001 From: Steve Martinelli Date: Tue, 8 Nov 2016 10:11:56 -0500 Subject: [PATCH] move old apiclient code out of openstack/common As part of the first community-wide goal [1], teams were asked to remove the openstack/common package of their projects if one existed. This was a byproduct of the old oslo-incubator form of syncing common functionality. The package, apiclient, was moved to a top level location and cliutils was moved to the common module. There are no oslo specific libraries, the recommended solution is to move it in tree and maintain it there. [1] http://governance.openstack.org/goals/ocata/remove-incubated-oslo-code.html Change-Id: If28f22e5ff6002bef8d9dfc27a694d1100535dc9 --- monascaclient/{openstack => apiclient}/__init__.py | 0 .../{openstack/common => }/apiclient/base.py | 5 ++--- .../{openstack/common => }/apiclient/exceptions.py | 6 ++---- monascaclient/common/monasca_manager.py | 2 +- monascaclient/openstack/common/__init__.py | 0 .../openstack/common/apiclient/__init__.py | 14 -------------- monascaclient/v2_0/alarm_definitions.py | 2 +- monascaclient/v2_0/alarms.py | 2 +- monascaclient/v2_0/metrics.py | 2 +- monascaclient/v2_0/notifications.py | 2 +- monascaclient/v2_0/notificationtypes.py | 2 +- openstack-common.conf | 7 ------- tox.ini | 2 +- 13 files changed, 11 insertions(+), 35 deletions(-) rename monascaclient/{openstack => apiclient}/__init__.py (100%) rename monascaclient/{openstack/common => }/apiclient/base.py (99%) rename monascaclient/{openstack/common => }/apiclient/exceptions.py (99%) delete mode 100644 monascaclient/openstack/common/__init__.py delete mode 100644 monascaclient/openstack/common/apiclient/__init__.py delete mode 100644 openstack-common.conf diff --git a/monascaclient/openstack/__init__.py b/monascaclient/apiclient/__init__.py similarity index 100% rename from monascaclient/openstack/__init__.py rename to monascaclient/apiclient/__init__.py diff --git a/monascaclient/openstack/common/apiclient/base.py b/monascaclient/apiclient/base.py similarity index 99% rename from monascaclient/openstack/common/apiclient/base.py rename to monascaclient/apiclient/base.py index 5c96e09..c3ce77b 100644 --- a/monascaclient/openstack/common/apiclient/base.py +++ b/monascaclient/apiclient/base.py @@ -31,7 +31,7 @@ from oslo_utils import strutils import six from six.moves.urllib import parse -from monascaclient.openstack.common.apiclient import exceptions +from monascaclient.apiclient import exceptions def getid(obj): @@ -440,8 +440,7 @@ class Resource(object): @property def human_id(self): - """Human-readable ID which can be used for bash completion. - """ + """Human-readable ID which can be used for bash completion.""" if self.NAME_ATTR in self.__dict__ and self.HUMAN_ID: return strutils.to_slug(getattr(self, self.NAME_ATTR)) return None diff --git a/monascaclient/openstack/common/apiclient/exceptions.py b/monascaclient/apiclient/exceptions.py similarity index 99% rename from monascaclient/openstack/common/apiclient/exceptions.py rename to monascaclient/apiclient/exceptions.py index d8af47a..ce172a9 100644 --- a/monascaclient/openstack/common/apiclient/exceptions.py +++ b/monascaclient/apiclient/exceptions.py @@ -28,8 +28,7 @@ import six class ClientException(Exception): - """The base exception class for all exceptions this library raises. - """ + """The base exception class for all exceptions this library raises.""" pass @@ -102,8 +101,7 @@ class AmbiguousEndpoints(EndpointException): class HttpError(ClientException): - """The base exception class for all HTTP exceptions. - """ + """The base exception class for all HTTP exceptions.""" http_status = 0 message = "HTTP Error" diff --git a/monascaclient/common/monasca_manager.py b/monascaclient/common/monasca_manager.py index f701062..8eae6eb 100644 --- a/monascaclient/common/monasca_manager.py +++ b/monascaclient/common/monasca_manager.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from monascaclient.openstack.common.apiclient import base +from monascaclient.apiclient import base class MonascaManager(base.BaseManager): diff --git a/monascaclient/openstack/common/__init__.py b/monascaclient/openstack/common/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/monascaclient/openstack/common/apiclient/__init__.py b/monascaclient/openstack/common/apiclient/__init__.py deleted file mode 100644 index f3d0cde..0000000 --- a/monascaclient/openstack/common/apiclient/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2013 OpenStack Foundation -# All Rights Reserved. -# -# 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. diff --git a/monascaclient/v2_0/alarm_definitions.py b/monascaclient/v2_0/alarm_definitions.py index aee635e..2d8b963 100644 --- a/monascaclient/v2_0/alarm_definitions.py +++ b/monascaclient/v2_0/alarm_definitions.py @@ -15,8 +15,8 @@ from six.moves.urllib import parse +from monascaclient.apiclient import base from monascaclient.common import monasca_manager -from monascaclient.openstack.common.apiclient import base class AlarmDefinitions(base.Resource): diff --git a/monascaclient/v2_0/alarms.py b/monascaclient/v2_0/alarms.py index 253792b..784a2f7 100644 --- a/monascaclient/v2_0/alarms.py +++ b/monascaclient/v2_0/alarms.py @@ -15,8 +15,8 @@ from six.moves.urllib import parse +from monascaclient.apiclient import base from monascaclient.common import monasca_manager -from monascaclient.openstack.common.apiclient import base class Alarms(base.Resource): diff --git a/monascaclient/v2_0/metrics.py b/monascaclient/v2_0/metrics.py index 9840579..709b0c9 100644 --- a/monascaclient/v2_0/metrics.py +++ b/monascaclient/v2_0/metrics.py @@ -17,8 +17,8 @@ from copy import deepcopy from six.moves.urllib import parse +from monascaclient.apiclient import base from monascaclient.common import monasca_manager -from monascaclient.openstack.common.apiclient import base class Metrics(base.Resource): diff --git a/monascaclient/v2_0/notifications.py b/monascaclient/v2_0/notifications.py index fa38cf6..adaf57d 100644 --- a/monascaclient/v2_0/notifications.py +++ b/monascaclient/v2_0/notifications.py @@ -17,8 +17,8 @@ from copy import deepcopy from six.moves.urllib import parse +from monascaclient.apiclient import base from monascaclient.common import monasca_manager -from monascaclient.openstack.common.apiclient import base class Notifications(base.Resource): diff --git a/monascaclient/v2_0/notificationtypes.py b/monascaclient/v2_0/notificationtypes.py index 41ebe1e..a7fbde0 100644 --- a/monascaclient/v2_0/notificationtypes.py +++ b/monascaclient/v2_0/notificationtypes.py @@ -15,8 +15,8 @@ from six.moves.urllib import parse +from monascaclient.apiclient import base from monascaclient.common import monasca_manager -from monascaclient.openstack.common.apiclient import base class NotificationTypes(base.Resource): diff --git a/openstack-common.conf b/openstack-common.conf deleted file mode 100644 index c9050aa..0000000 --- a/openstack-common.conf +++ /dev/null @@ -1,7 +0,0 @@ -[DEFAULT] - -# The list of modules to copy from openstack-common -modules=gettextutils,apiclient.base,apiclient.exceptions - -# The base module to hold the copy of openstack.common -base=monascaclient diff --git a/tox.ini b/tox.ini index 48aae5e..0c80049 100644 --- a/tox.ini +++ b/tox.ini @@ -32,4 +32,4 @@ max-line-length = 120 # H803 git commit title should not end with period ignore = H302,H803 builtins = _ -exclude=.venv,.git,.tox,dist,client_api_example.py,*openstack/common*,*lib/python*,*egg,build +exclude=.venv,.git,.tox,dist,client_api_example.py,*lib/python*,*egg,build