Cleanup py27 support

This repo is now testing only with Python 3, so let's make
a few cleanups:
- Remove python 2.7 stanza from setup.py
- Remove obsolete sections from setup.cfg
- Update classifiers
- This repo has no docs, remove releasenotes and docs building
  infrastructure
- Cleanup */source/conf.py to remove now obsolete content.
- Remove install_command from tox.ini, the default is fine
- Remove Babel from requirements, it's not needed for running.
- Use TOX_CONSTRAINTS_FILE, UPPER_CONSTRAINTS_FILE is obsolete
- Update to hacking 3.0, fix problems found

Change-Id: I9133baec6cb123440f34b8c4b31001cfe875919e
This commit is contained in:
Andreas Jaeger 2020-05-09 17:52:04 +02:00
parent 5d1caeb37f
commit 9908379f82
21 changed files with 51 additions and 91 deletions

View File

@ -21,6 +21,7 @@ Base utilities to build API operation managers and objects on top of.
"""
import abc
import copy
import six
from oslo_utils import reflection
from oslo_utils import strutils

View File

@ -17,8 +17,8 @@ import logging
import os
from keystoneauth1 import adapter
from keystoneauth1 import session as ks_session
from keystoneauth1.identity import v3
from keystoneauth1 import session as ks_session
from oslo_utils import importutils
import requests
@ -98,7 +98,7 @@ class SessionClient(adapter.LegacyJsonAdapter):
raise exc.InvalidEndpoint(message=message)
if (self.endpoint_override is not None and
location.lower().startswith(self.endpoint_override.lower())):
return location[len(self.endpoint_override):]
return location[len(self.endpoint_override):]
else:
return location

View File

@ -12,11 +12,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
import json
import logging
from osc_lib.i18n import _
from osc_lib.command import command
from osc_lib.i18n import _
LOG = logging.getLogger(__name__)
@ -79,7 +79,7 @@ class NotificationShow(command.ShowOne):
class NotificationAcknowledge(command.Command):
""" Approve and show details of a notification."""
"""Approve and show details of a notification."""
def get_parser(self, prog_name):
parser = super(NotificationAcknowledge, self).get_parser(prog_name)

View File

@ -23,8 +23,8 @@ LOG = logging.getLogger(__name__)
class QuotaShow(command.Lister):
"""
Displays current quota information.
"""Displays current quota information.
If not given a region it will print basic details of the state of
the quotas. If given a region it will print all details for it.
"""
@ -71,9 +71,7 @@ class QuotaShow(command.Lister):
class QuotaSizes(command.Lister):
"""
Displays possible quota sizes.
"""
"""Displays possible quota sizes."""
def take_action(self, parsed_args):
client = self.app.client_manager.admin_logic
@ -93,9 +91,7 @@ class QuotaSizes(command.Lister):
class QuotaTasks(command.Lister):
"""
Displays quota tasks.
"""
"""Displays quota tasks."""
def take_action(self, parsed_args):
client = self.app.client_manager.admin_logic

View File

@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
import json
import logging
from osc_lib.command import command
from osc_lib.i18n import _

View File

@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
import json
import logging
from osc_lib.command import command

View File

@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
import json
import logging
from osc_lib.command import command
from osc_lib.i18n import _
@ -91,7 +91,7 @@ class TaskShow(command.ShowOne):
class TaskApprove(command.ShowOne):
""" Approve and show details of a task."""
"""Approve and show details of a task."""
def get_parser(self, prog_name):
parser = super(TaskApprove, self).get_parser(prog_name)
@ -107,7 +107,7 @@ class TaskApprove(command.ShowOne):
class TaskCancel(command.ShowOne):
""" Approve and show details of a task."""
"""Approve and show details of a task."""
def get_parser(self, prog_name):
parser = super(TaskCancel, self).get_parser(prog_name)
@ -143,7 +143,7 @@ class TaskUpdate(command.ShowOne):
class TaskTokenReissue(command.Command):
""" Reissues a token for the provided pending task """
"""Reissues a token for the provided pending task """
def get_parser(self, prog_name):
parser = super(TaskTokenReissue, self).get_parser(prog_name)

View File

@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
import json
import logging
from osc_lib.command import command
from osc_lib.i18n import _
@ -24,13 +24,13 @@ LOG = logging.getLogger(__name__)
def _list_tokens(client, filters={}):
tokens = client.tokens.list(filters=filters)
tokens = client.tokens.list(filters=filters)
headers = ['Token', 'Task', 'Expires on', 'Created on']
rows = [[token.token, token.task, token.expires,
token.created_on] for token in tokens]
headers = ['Token', 'Task', 'Expires on', 'Created on']
rows = [[token.token, token.task, token.expires,
token.created_on] for token in tokens]
return headers, rows
return headers, rows
class TokenList(command.Lister):

View File

@ -14,9 +14,9 @@
import logging
from osc_lib import utils
from osc_lib.command import command
from osc_lib.i18n import _
from osc_lib import utils
from adjutantclient import client as adjutant_client
from adjutantclient import exc
@ -61,8 +61,8 @@ class UserShow(command.ShowOne):
class UserInvite(command.Command):
"""
Invites a user to become a member of a project.
"""Invites a user to become a member of a project.
User does not need to have an existing openstack account.
"""
@ -92,7 +92,7 @@ class UserInvite(command.Command):
class UserInviteCancel(command.Command):
""" Cancel invite(s) to a project."""
"""Cancel invite(s) to a project."""
def get_parser(self, prog_name):
parser = super(UserInviteCancel, self).get_parser(prog_name)
@ -114,7 +114,7 @@ class UserInviteCancel(command.Command):
class UserRoleAdd(command.Command):
""" Add a role to a user."""
"""Add a role to a user."""
def get_parser(self, prog_name):
parser = super(UserRoleAdd, self).get_parser(prog_name)
@ -136,7 +136,7 @@ class UserRoleAdd(command.Command):
class UserRoleRemove(command.Command):
""" Remove a role from a user."""
"""Remove a role from a user."""
def get_parser(self, prog_name):
parser = super(UserRoleRemove, self).get_parser(prog_name)
@ -178,7 +178,7 @@ class UserRoleList(command.Lister):
class ManageableRolesList(command.Lister):
""" Lists roles able to be managed by the current user """
"""Lists roles able to be managed by the current user """
def take_action(self, parsed_args):
client = self.app.client_manager.admin_logic
roles = client.managed_roles.list()
@ -189,7 +189,7 @@ class ManageableRolesList(command.Lister):
class PasswordReset(command.Command):
""" Force password reset for a user, admin only. """
"""Force password reset for a user, admin only. """
def get_parser(self, prog_name):
parser = super(PasswordReset, self).get_parser(prog_name)
@ -217,7 +217,7 @@ class PasswordReset(command.Command):
class PasswordForgot(command.Command):
""" Links to user forgotten password endpoint, does not require auth."""
"""Links to user forgotten password endpoint, does not require auth."""
auth_required = False
def get_parser(self, prog_name):

View File

@ -14,13 +14,13 @@
from adjutantclient.common import http
from adjutantclient.v1 import notifications
from adjutantclient.v1 import quota
from adjutantclient.v1 import roles
from adjutantclient.v1 import signup
from adjutantclient.v1 import status
from adjutantclient.v1 import tasks
from adjutantclient.v1 import tokens
from adjutantclient.v1 import users
from adjutantclient.v1 import quota
class Client(object):

View File

@ -38,9 +38,7 @@ class NotificationManager(base.ManagerWithFind):
return self._list(url, 'notifications')
def acknowledge(self, note_id=None, note_list=[]):
"""
Acknowledge a single notification or many.
"""
"""Acknowledge a single notification or many."""
if note_id:
data = {'acknowledged': True}
url = 'notifications/%s' % note_id

View File

@ -20,7 +20,7 @@ from adjutantclient.common import base
class QuotaManager(base.BaseManager):
def get(self, regions=None):
""" Gets data about current quota settings """
"""Gets data about current quota settings"""
url = '/openstack/quotas/'
if regions:
url += '?%s' % parse.urlencode({
@ -29,7 +29,8 @@ class QuotaManager(base.BaseManager):
return self.client.get(url).json()
def update(self, size, regions=None):
""" Updates the quota to a specified size.
"""Updates the quota to a specified size.
If region is not set it will update all regions
"""
url = '/openstack/quotas/'

View File

@ -41,9 +41,7 @@ class ManagedRoleManager(base.ManagerWithFind):
return self._list(url, 'roles')
def get(self, role_id):
"""
Get a role by role_id
"""
"""Get a role by role_id"""
# Right now the only way is to list them all, then iterate.
# Perhaps a filter or new endpoint would be useful here.
roles = self.list()
@ -58,13 +56,13 @@ class UserRoleManager(base.BaseManager):
def list(self, **kwargs):
"""List roles for a given user"""
# TODO: Look up user by name/id
# TODO(adriant): Look up user by name/id
url = '/openstack/users/%s/roles' % kwargs['user']
return self._list(url, 'roles')
def add(self, user, role=None, roles=None):
"""Add a role to a user"""
# TODO: resolve the roles and users into id's
# TODO(adriant): resolve the roles and users into id's
# user_id = base.getid(user)
user_id = user
# role_id = role

View File

@ -38,15 +38,12 @@ class TaskManager(base.ManagerWithFind):
return self._list(url, 'tasks')
def update(self, task_id, data):
"""
Update a task with new data and rerun pre-approve validation.
"""
"""Update a task with new data and rerun pre-approve validation."""
url = 'tasks/%s' % task_id
return self._put(url, data)
def approve(self, task_id):
"""
Approve a task.
"""Approve a task.
If already approved will rerun post-approve validation
and reissue/resend token.
@ -56,8 +53,6 @@ class TaskManager(base.ManagerWithFind):
return self._post(url, data)
def cancel(self, task_id):
"""
Cancel a task.
"""
"""Cancel a task."""
url = 'tasks/%s' % task_id
return self._delete(url)

View File

@ -48,7 +48,7 @@ class TokenManager(base.BaseManager):
return self._post(url, parameters)
def reissue(self, task_id):
""" Given a task id, reissues the tokens associated with that task """
"""Given a task id, reissues the tokens associated with that task"""
url = 'tokens'
data = {
'task': task_id

View File

@ -82,7 +82,7 @@ class UserManager(base.ManagerWithFind):
return paginate(params)
def invite(self, username, email, role_list):
""" Invite a user to the current project. """
"""Invite a user to the current project."""
fields = {
'username': username,
@ -92,16 +92,12 @@ class UserManager(base.ManagerWithFind):
return self.client.post('openstack/users', data=fields)
def cancel(self, user_id):
"""
Cancel a user invite task.
"""
"""Cancel a user invite task."""
url = 'openstack/users/%s' % user_id
return self._delete(url)
def revoke(self, user_id):
"""
revoke all user roles on project.
"""
"""Revoke all user roles on project."""
# NOTE(adriant): This doesn't work yet.
# Uses the same endpoint as cancel, but doesn't
# yet actually revoke all roles if an actual user
@ -118,8 +114,7 @@ class UserManager(base.ManagerWithFind):
data=params)
def password_force_reset(self, email):
"""
Force a password reset for a user.
"""Force a password reset for a user.
This is an admin only function.
"""

View File

@ -2,7 +2,6 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
Babel!=2.4.0,>=2.3.4 # BSD
pbr>=3.0.0 # Apache-2.0
cliff>=2.6.0 # Apache-2.0
iso8601>=0.1.11 # MIT

View File

@ -58,7 +58,3 @@ openstack.admin_logic.v1 =
password_reset = adjutantclient.osc.v1.users:PasswordReset
signup = adjutantclient.osc.v1.signup:Signup
adjutant_status = adjutantclient.osc.v1.status:Status
[global]
setup-hooks =
pbr.hooks.setup_hook

View File

@ -13,17 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
# In python < 2.7.4, a lazy loading of package `pbr` will break
# setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215
try:
import multiprocessing # noqa
except ImportError:
pass
setuptools.setup(
setup_requires=['pbr>=1.6'],
pbr=True)

View File

@ -1,21 +1,16 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=0.11.0,<0.12 # Apache-2.0
hacking>=3.0,<3.1.0 # Apache-2.0
coverage>=3.6 # Apache-2.0
ddt>=1.0.1 # MIT
discover # BSD
fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0 # BSD
requests-mock>=0.7.0 # Apache-2.0
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 # BSD
os-client-config>=1.13.1 # Apache-2.0
oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0
testrepository>=0.0.18 # Apache-2.0/BSD
testscenarios>=0.4 # Apache-2.0/BSD
testtools>=1.4.0 # MIT
tempest>=11.0.0 # Apache-2.0
os-testr>=0.8.0 # Apache-2.0
# releasenotes
reno>=1.6.2 # Apache2

11
tox.ini
View File

@ -7,20 +7,18 @@ ignore_basepython_conflict = True
[testenv]
basepython = python3
usedevelop = True
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
OS_STDOUT_NOCAPTURE=False
OS_STDERR_NOCAPTURE=False
PYTHONHASHSEED=0
deps = -r{toxinidir}/requirements.txt
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = ostestr {posargs}
whitelist_externals = find
[tox:jenkins]
sitepackages = True
[testenv:pep8]
commands = flake8
@ -34,9 +32,6 @@ commands =
[testenv:venv]
commands = {posargs}
[testenv:docs]
commands = python setup.py build_sphinx
[flake8]
show-source = True
exclude=.venv,.git,.tox,dist,*lib/python*,*egg,build,doc/source/conf.py,releasenotes