Update tox.ini and fix pep8 errors

1.Add [testenv:lower-constraints]
2.Add lower-constraints.txt
3.Check env:UPPER_CONSTRAINTS_FILE
4.Remove  passenv parameters which are not required
5.Fix pep8 errors

Change-Id: I8ec8aac38e80a6e2b8ce9e9dc70f0cf187c0ce7c
This commit is contained in:
Cai Hui 2018-11-07 03:39:20 -05:00
parent 0c4713108c
commit b008ef902d
16 changed files with 184 additions and 50 deletions

View File

@ -11,8 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import yaml
import os import os
import yaml
class YamlParser(object): class YamlParser(object):

View File

@ -11,12 +11,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from freezer_dr.evacuators.common.utils import get_nodes_details
from freezer_dr.fencers.common.manager import FencerManager
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log from oslo_log import log
from oslo_utils import importutils from oslo_utils import importutils
from freezer_dr.fencers.common.manager import FencerManager
from time import sleep from time import sleep
from freezer_dr.evacuators.common.utils import get_nodes_details
CONF = cfg.CONF CONF = cfg.CONF
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)

View File

@ -11,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from freezer_dr.common.utils import get_os_client, get_admin_os_client from freezer_dr.common.utils import get_admin_os_client
from freezer_dr.common.utils import get_os_client
def get_nodes_details(nodes): def get_nodes_details(nodes):

View File

@ -11,11 +11,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from freezer_dr.common.utils import get_os_client
from freezer_dr.evacuators.common.driver import EvacuatorBaseDriver
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log from oslo_log import log
from freezer_dr.evacuators.common.driver import EvacuatorBaseDriver
from freezer_dr.common.utils import get_os_client
import time import time
CONF = cfg.CONF CONF = cfg.CONF
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)

View File

@ -15,8 +15,8 @@
from freezer_dr.common.yaml_parser import YamlParser from freezer_dr.common.yaml_parser import YamlParser
from freezer_dr.fencers.common.driver import FencerBaseDriver from freezer_dr.fencers.common.driver import FencerBaseDriver
from freezer_dr.fencers.drivers.ipmi.ipmitool import IpmiInterface from freezer_dr.fencers.drivers.ipmi.ipmitool import IpmiInterface
from oslo_log import log
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log
import time import time
CONF = cfg.CONF CONF = cfg.CONF

View File

@ -12,11 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import sys
import subprocess
from distutils import spawn from distutils import spawn
from oslo_log import log from oslo_log import log
import subprocess
import sys
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)

View File

@ -14,8 +14,8 @@
from freezer_dr.common.yaml_parser import YamlParser from freezer_dr.common.yaml_parser import YamlParser
from freezer_dr.fencers.common.driver import FencerBaseDriver from freezer_dr.fencers.common.driver import FencerBaseDriver
import libvirt import libvirt
from oslo_log import log
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log
import time import time
CONF = cfg.CONF CONF = cfg.CONF

View File

@ -15,11 +15,12 @@
from __future__ import print_function from __future__ import print_function
from freezer_dr.common import config from freezer_dr.common import config
from freezer_dr.evacuators.common.manager import EvacuationManager
from freezer_dr.monitors.common.manager import MonitorManager
from freezer_dr.notifiers.common.manager import NotificationManager
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log from oslo_log import log
from freezer_dr.monitors.common.manager import MonitorManager
from freezer_dr.evacuators.common.manager import EvacuationManager
from freezer_dr.notifiers.common.manager import NotificationManager
CONF = cfg.CONF CONF = cfg.CONF
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)

View File

@ -13,12 +13,15 @@
# limitations under the License. # limitations under the License.
from freezer_dr.common.osclient import OSClient from freezer_dr.common.osclient import OSClient
from freezer_dr.monitors.common.driver import MonitorBaseDriver from freezer_dr.monitors.common.driver import MonitorBaseDriver
from time import sleep
from oslo_config import cfg
from oslo_log import log
from httplib import HTTPConnection from httplib import HTTPConnection
from httplib import HTTPSConnection from httplib import HTTPSConnection
from httplib import socket from httplib import socket
from oslo_config import cfg
from oslo_log import log
from time import sleep
from urlparse import urlparse from urlparse import urlparse
CONF = cfg.CONF CONF = cfg.CONF

View File

@ -11,8 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import six
import abc import abc
import six
@six.add_metaclass(abc.ABCMeta) @six.add_metaclass(abc.ABCMeta)

View File

@ -11,15 +11,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from oslo_config import cfg
from oslo_log import log
from freezer_dr.notifiers.common.driver import NotifierBaseDriver
from freezer_dr.common.utils import load_jinja_templates
from datetime import date from datetime import date
import time
import smtplib
from email.mime.multipart import MIMEMultipart from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText from email.mime.text import MIMEText
from freezer_dr.common.utils import load_jinja_templates
from freezer_dr.notifiers.common.driver import NotifierBaseDriver
from oslo_config import cfg
from oslo_log import log
import smtplib
import time
CONF = cfg.CONF CONF = cfg.CONF
@ -114,7 +114,7 @@ class StandardEmail(NotifierBaseDriver):
cc_list=self.admin_list or [] cc_list=self.admin_list or []
) )
return True return True
except: except Exception:
return False return False
def __exit__(self, exc_type, exc_val, exc_tb): def __exit__(self, exc_type, exc_val, exc_tb):

View File

@ -11,18 +11,17 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from oslo_log import log
from freezer_dr.notifiers.common.driver import NotifierBaseDriver
from datetime import date from datetime import date
from six.moves import urllib from freezer_dr.notifiers.common.driver import NotifierBaseDriver
import requests
import json import json
from oslo_log import log
import requests
from six.moves import urllib
import time import time
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
class SlackNotifier(NotifierBaseDriver): class SlackNotifier(NotifierBaseDriver):
MAX_CACHE_SIZE = 100 MAX_CACHE_SIZE = 100

124
lower-constraints.txt Normal file
View File

@ -0,0 +1,124 @@
alabaster==0.7.10
appdirs==1.4.3
APScheduler==3.0.5
asn1crypto==0.24.0
astroid==1.3.8
Babel==2.5.3
bcrypt==3.1.4
botocore==1.5.1
certifi==2018.1.18
cffi==1.11.5
chardet==3.0.4
cliff==2.11.0
cmd2==0.8.1
coverage==4.0
cryptography==2.1
ddt==1.0.1
debtcollector==1.19.0
decorator==4.2.1
deprecation==2.0
doc8==0.6.0
docutils==0.14
dogpile.cache==0.6.5
dulwich==0.19.0
enum-compat==0.0.2
eventlet==0.20.0
extras==1.0.0
fasteners==0.14.1
fixtures==3.0.0
flake8==2.5.4
future==0.16.0
greenlet==0.4.13
hacking==0.12.0
idna==2.6
imagesize==1.0.0
iso8601==0.1.12
Jinja2==2.10
jmespath==0.9.3
jsonpatch==1.21
jsonpointer==2.0
jsonschema==2.6.0
keystoneauth1==3.4.0
linecache2==1.0.0
logilab-common==1.4.1
libvirt-python==1.2.5
MarkupSafe==1.0
mccabe==0.4.0
mock==2.0.0
monotonic==1.4
msgpack==0.5.6
munch==2.2.0
netaddr==0.7.19
netifaces==0.10.6
openstackdocstheme==1.18.1
openstacksdk==0.12.0
os-brick==2.2.0
os-client-config==1.29.0
os-service-types==1.2.0
os-win==4.0.0
osc-lib==1.10.0
oslo.concurrency==3.26.0
oslo.config==5.2.0
oslo.context==2.20.0
oslo.i18n==3.20.0
oslo.log==3.36.0
oslo.privsep==1.28.0
oslo.serialization==2.25.0
oslo.service==1.24.0
oslo.utils==3.33.0
packaging==17.1
paramiko==2.0.0
Paste==2.0.3
PasteDeploy==1.5.2
pbr==2.0.0
pep8==1.7.1
prettytable==0.7.2
psutil==3.2.2
pyasn1==0.4.2
pycparser==2.18
pyflakes==1.0.0
Pygments==2.2.0
pyinotify==0.9.6
pylint==1.4.5
pymongo==3.0.2
PyMySQL==0.7.6
PyNaCl==1.2.1
pyOpenSSL==17.5.0
pyparsing==2.2.0
pyperclip==1.6.0
python-dateutil==2.7.0
python-keystoneclient==3.8.0
python-monascaclient==1.1.0
python-neutronclient==6.7.0
python-novaclient==9.1.0
python-openstackclient==3.12.0
python-subunit==1.2.0
python-swiftclient==3.2.0
pytz==2018.3
PyYAML==3.12.0
reno==2.5.0
repoze.lru==0.7
requests==2.18.4
requestsexceptions==1.4.0
retrying==1.3.3
rfc3986==1.1.0
Routes==2.4.1
setuptools==21.0.0
simplejson==3.13.2
six==1.10.0
snowballstemmer==1.2.1
Sphinx==1.6.2
sphinxcontrib-websupport==1.0.1
stestr==2.0.0
stevedore==1.28.0
tempest==17.1.0
stestr==2.0.0
testtools==2.2.0
traceback2==1.4.0
tzlocal==1.5.1
unittest2==1.1.0
urllib3==1.22
voluptuous==0.11.1
warlock==1.3.0
WebOb==1.7.4
wrapt==1.10.11

View File

@ -1,11 +1,11 @@
pbr!=2.1.0,>=2.0 # Apache-2.0 pbr>=2.0.0 # Apache-2.0
python-keystoneclient>=3.8.0 # Apache-2.0 python-keystoneclient>=3.8.0 # Apache-2.0
python-monascaclient>=1.1.0 # Apache-2.0 python-monascaclient>=1.1.0 # Apache-2.0
python-neutronclient>=5.1.0 # Apache-2.0 python-neutronclient>=6.7.0 # Apache-2.0
python-novaclient>=6.0.0 # Apache-2.0 python-novaclient>=9.1.0 # Apache-2.0
PyYAML>=3.10.0 # MIT PyYAML>=3.12.0 # MIT
oslo.config>=3.14.0,!=4.4.0,!=4.3.0 # Apache-2.0 oslo.config>=5.2.0 # Apache-2.0
oslo.utils>=3.18.0 # Apache-2.0 oslo.utils>=3.33.0 # Apache-2.0
oslo.log>=3.11.0 # Apache-2.0 oslo.log>=3.36.0 # Apache-2.0
libvirt-python>=1.2.5 # LGPLv2+ libvirt-python>=1.2.5 # LGPLv2+
Jinja2>=2.8 # BSD License (3 clause) Jinja2>=2.10 # BSD License (3 clause)

View File

@ -4,13 +4,12 @@
astroid==1.6.5 # LGPLv2.1 astroid==1.6.5 # LGPLv2.1
flake8>=2.5.4,<2.6.0 # MIT flake8>=2.5.4,<2.6.0 # MIT
hacking>=0.12.0,!=0.13.0,<0.14 # Apache-2.0 hacking>=0.12.0,!=0.13.0,<0.14 # Apache-2.0
coverage>=3.6 coverage>=4.0
mock>=1.0 mock>=2.0.0
pep8==1.5.7 mccabe==0.4.0 # MIT License
mccabe==0.2.1 # MIT License
pylint==1.9.2 # GPLv2 pylint==1.9.2 # GPLv2
pyflakes==0.8.1 pyflakes==1.0.0
stestr>=2.0.0 # Apache-2.0 stestr>=2.0.0 # Apache-2.0
testtools>=0.9.36 testtools>=2.2.0
sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD
openstackdocstheme>=1.18.1 # Apache-2.0 openstackdocstheme>=1.18.1 # Apache-2.0

18
tox.ini
View File

@ -7,13 +7,9 @@ usedevelop = True
deps = -r{toxinidir}/requirements.txt deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
passenv = passenv =
FREEZER_TEST_OS_TENANT_NAME
FREEZER_TEST_OS_USERNAME
FREEZER_TEST_OS_REGION_NAME
FREEZER_TEST_OS_PASSWORD
FREEZER_TEST_OS_AUTH_URL
http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
install_command = pip install -U {opts} {packages}
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
setenv = setenv =
VIRTUAL_ENV={envdir} VIRTUAL_ENV={envdir}
OS_TEST_PATH = ./tests/unit OS_TEST_PATH = ./tests/unit
@ -24,9 +20,10 @@ commands =
coverage combine coverage combine
coverage html -d cover coverage html -d cover
coverage xml -o cover/coverage.xml coverage xml -o cover/coverage.xml
# coverage report -m coverage report -m
rm -f .coverage rm -f .coverage
rm -rf .testrepository rm -rf .testrepository
whitelist_externals = whitelist_externals =
find find
coverage coverage
@ -78,3 +75,10 @@ ignore = H
select = H102, H103, H201, H501, H903, H201, H306, H301, H233 select = H102, H103, H201, H501, H903, H201, H306, H301, H233
show-source = True show-source = True
exclude = .venv,.tox,dist,doc,test,*egg,tests exclude = .venv,.tox,dist,doc,test,*egg,tests
[testenv:lower-constraints]
basepython = python3
deps =
-c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt