Update to work with py38

Removed py27 tox tests and added py38 in tox.
Also fixed some pep8 violations.
This commit is contained in:
Hemna 2020-07-30 10:15:35 -04:00
parent 7dae6c4f2a
commit a9db350555
8 changed files with 40 additions and 19 deletions

View File

@ -21,11 +21,12 @@ host.
import json
import logging
import requests
import time
from rbd_iscsi_client import exceptions
import requests
class RBDISCSIClient(object):
"""REST client to rbd-target-api."""
@ -193,7 +194,7 @@ class RBDISCSIClient(object):
self.delay = self.delay * self.backoff + 1
# Raise exception, we have exhausted all retries.
if self.tries is 0:
if self.tries == 0:
raise ex
except requests.exceptions.HTTPError as err:
raise exceptions.HTTPError("HTTP Error: %s" % err)
@ -241,6 +242,18 @@ class RBDISCSIClient(object):
"""Get the complete config object."""
return self.get("/api/config")
def get_sys_info(self, type):
"""Get system info of <type>.
Valid types are:
ip_address
checkconf
checkversions
"""
api = "/api/sysinfo/%(type)s" % {'type': type}
return self.get(api)
def get_gatewayinfo(self):
"""Get the number of active sessions on local gateway."""
return self.get("/api/gatewayinfo")
@ -250,6 +263,11 @@ class RBDISCSIClient(object):
api = "/api/targets"
return self.get(api)
def get_target_info(self, target_iqn):
"""Returns the total number of active sessions for <target_iqn>"""
api = "/api/targetinfo/%(target_iqn)s" % {'target_iqn': target_iqn}
return self.get(api)
def create_target_iqn(self, target_iqn, mode=None, controls=None):
"""Create the target iqn on the gateway."""
api = "/api/target/%(target_iqn)s" % {'target_iqn': target_iqn}

View File

@ -11,8 +11,8 @@
# under the License.
"""Tests for `rbd_iscsi_client` package."""
import mock
import unittest
from unittest import mock
from rbd_iscsi_client import client

View File

@ -11,13 +11,14 @@
# under the License.
"""Tests for `rbd_iscsi_client` package."""
import mock
import requests
import unittest
from unittest import mock
from rbd_iscsi_client import client
from rbd_iscsi_client import exceptions
import requests
class TestRbd_iscsi_client(unittest.TestCase):
"""Tests for `rbd_iscsi_client` package."""

View File

@ -2,10 +2,10 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
pbr!=2.1.0,>=2.0.0 # Apache-2.0
pbr!=2.1.0,>=5.4.1 # Apache-2.0
Babel!=2.4.0,>=2.3.4 # BSD
oslo.log>=3.36.0 # Apache-2.0
oslo.i18n>=3.15.3 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0
requests>=2.14.2 # Apache-2.0
oslo.log>=3.44.0 # Apache-2.0
oslo.i18n>=3.24.0 # Apache-2.0
oslo.utils>=3.34.0 # Apache-2.0
requests>=2.14.2,!=2.20.0 # Apache-2.0
six>=1.10.0 # MIT

View File

@ -16,11 +16,10 @@ classifier =
Intended Audience :: System Administrators
License :: OSI Approved :: Apache Software License
Natural Language :: English
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
[global]
setup-hooks =

View File

@ -3,10 +3,13 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=1.1.0,<1.2.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
ddt>=1.0.1 # MIT
reno>=2.5.0 # Apache-2.0
hacking!=3.1.0,>=2.2.0 # Apache-2.0
flake8-import-order # LGPLv3
flake8-logging-format>=0.6.0 #Apache-2.0
coverage!=4.4,>=4.1 # Apache-2.0
ddt>=1.2.1 # MIT
reno>=3.1.0 # Apache-2.0
sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD
openstackdocstheme>=1.18.1 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0

View File

@ -24,6 +24,7 @@ import sys
from pylint import lint
from pylint.reporters import text
from six.moves import cStringIO as StringIO
ignore_codes = [

View File

@ -1,14 +1,13 @@
[tox]
minversion = 2.0
envlist = py27,py36,py37,pep8
envlist = py36,py37,py38,pep8
skipdist = True
[travis]
python =
3.8: py38
3.7: py37
3.6: py36
2.7: py27
[testenv]
usedevelop = True