Fixing Tox Pep8 errors of type F821

Change-Id: I3471ace9c5efc0b735765747a056288be5556be4
Story: 2002888
Task: 23097
Signed-off-by: Mathieu Robinson <mathieu.robinson@windriver.com>
Signed-off-by: Jack Ding <jack.ding@windriver.com>
This commit is contained in:
Mathieu Robinson 2018-05-31 16:19:13 -04:00 committed by Jack Ding
parent 6bc915d90a
commit 3926523fab
8 changed files with 11 additions and 52 deletions

View File

@ -6,7 +6,7 @@
import time
import json
from rest_api import rest_api_request
from sysinv.common import exception as si_exception
from sysinv.openstack.common import log
LOG = log.getLogger(__name__)

View File

@ -345,7 +345,7 @@ class ServiceParameterController(rest.RestController):
if len(parameters) > 1:
msg = _("Cannot specify multiple parameters with custom resource.")
raise exc.CommandError(msg)
raise wsme.exc.CommandError(msg)
for name, value in parameters.iteritems():
new_record = {

View File

@ -26,33 +26,6 @@ CONF = cfg.CONF
LOG = log.getLogger(__name__)
# TODO(mpeters): packstack removal - upgrade support
def gen_upgrade_manifests(from_release, to_release):
mydbapi = dbapi.get_instance()
mypackstack = packstack.PackstackOperator(mydbapi)
LOG.info("Creating upgrade manifests for controller-1")
host = mydbapi.ihost_get_by_hostname(constants.CONTROLLER_1_HOSTNAME)
mypackstack.create_controller_upgrade_manifests(host,
from_release,
to_release)
# TODO(mpeters): packstack removal - upgrade support
def gen_manifests():
mydbapi = dbapi.get_instance()
mypackstack = packstack.PackstackOperator(mydbapi)
hostname = constants.CONTROLLER_1_HOSTNAME
if system_mode == constants.SYSTEM_MODE_SIMPLEX:
hostname = constants.CONTROLLER_0_HOSTNAME
LOG.info("Creating manifests for %s" % hostname)
host = mydbapi.ihost_get_by_hostname(hostname)
# This will also generate manifests for any subfunctions if present
mypackstack.update_host_manifests(host)
def update_controller_state():
mydbapi = dbapi.get_instance()
@ -83,12 +56,8 @@ def update_controller_state():
def add_action_parsers(subparsers):
for action in ['gen_upgrade_manifests', 'gen_manifests',
'update_controller_state']:
for action in ['update_controller_state']:
parser = subparsers.add_parser(action)
if action == 'gen_upgrade_manifests':
parser.add_argument('from_release')
parser.add_argument('to_release')
parser.set_defaults(func=globals()[action])
@ -103,20 +72,11 @@ def main():
# Parse config file and command line options, then start logging
service.prepare_service(sys.argv)
if CONF.action.name in ['gen_manifests',
'update_controller_state']:
if CONF.action.name in ['update_controller_state']:
msg = (_("Called '%(action)s'") %
{"action": CONF.action.name})
LOG.info(msg)
CONF.action.func()
elif CONF.action.name in ['gen_upgrade_manifests']:
msg = (_("Called '%(action)s'") %
{"action": CONF.action.name,
"to_release": CONF.action.to_release,
"from_release": CONF.action.from_release}
)
LOG.info(msg)
CONF.action.func(CONF.action.from_release, CONF.action.to_release)
else:
LOG.error(_("Unknown action: %(action)") % {"action":
CONF.action.name})

View File

@ -448,7 +448,7 @@ class CephOperator(object):
": {0}. reason: {1}").format(name, response.reason)
e = exception.CephFailure(reason=msg)
LOG.error(e)
self.delete_osd_pool(pool_name)
self.delete_osd_pool(name)
raise e
else:

View File

@ -6,7 +6,7 @@
#
import uuid
from datetime import datetime
from sqlalchemy import Integer, Boolean, String
from sqlalchemy import Column, MetaData, Table

View File

@ -7,7 +7,7 @@
import uuid
from datetime import datetime
from sqlalchemy import Integer
from sqlalchemy import Column, MetaData, Table
from sysinv.openstack.common import log

View File

@ -1866,7 +1866,7 @@ class TestMigrations(BaseMigrationTestCase, WalkVersionsMixin):
'capabilities': 'Text',
}
for col, coltype in storage_backend_cols.items():
self.assertTrue(isinstance(ceph_mon.c[col].type,
self.assertTrue(isinstance(storage_backend.c[col].type,
getattr(sqlalchemy.types, coltype)))
# Assert deletion of the i_storconfig table
self.assertTableNotExists(engine, 'storage_lvm')
@ -1882,7 +1882,7 @@ class TestMigrations(BaseMigrationTestCase, WalkVersionsMixin):
'id': 'Integer',
}
for col, coltype in storage_file_cols.items():
self.assertTrue(isinstance(ceph_file.c[col].type,
self.assertTrue(isinstance(storage_file.c[col].type,
getattr(sqlalchemy.types, coltype)))
# Assert deletion of the i_storconfig table
self.assertTableNotExists(engine, 'storage_file')

View File

@ -82,15 +82,14 @@ commands =
# H231..H238 are python3 compatability
# H401,H403,H404,H405 are docstring and not important
[flake8]
ignore = F821,F841,E501,E127,E128,E231,E266,E402,E711,E116,E203,E731,E712,E713,E702,E714,E126,E121,E722,H101,H102,H104,H105,H231,H232,H233,H234,H235,H236,H237,H238,H401,H403,H404,H405
ignore = F841,E501,E127,E128,E231,E266,E402,E711,E116,E203,E731,E712,E713,E702,E714,E126,E121,E722,H101,H102,H104,H105,H231,H232,H233,H234,H235,H236,H237,H238,H401,H403,H404,H405
builtins = _
[testenv:flake8]
basepython = python2.7
deps = flake8
commands = flake8 {posargs}
[testenv:py27]
basepython = python2.7